Class HttpUtils
A utility class that contains functions related to HTTP calls.
Inherited Members
Namespace: Oci.Common.Utils
Assembly: OCI.DotNetSDK.Common.dll
Syntax
public class HttpUtils
Fields
logger
Declaration
protected static Logger logger
Field Value
Type | Description |
---|---|
Logger |
Methods
BuildQueryString(List<string>)
Builds the string containing the query in request URL.
Declaration
public static string BuildQueryString(List<string> queries)
Parameters
Type | Name | Description |
---|---|---|
List<string> | queries | A Dictionary containing all queries to be send. |
Returns
Type | Description |
---|---|
string | The string representation of the queries in the request URL. |
BuildUserAgent(string)
Builds the useragent
Declaration
public static string BuildUserAgent(string clientUserAgent)
Parameters
Type | Name | Description |
---|---|---|
string | clientUserAgent |
Returns
Type | Description |
---|---|
string |
CloneHttpRequestMessage(HttpRequestMessage)
Make a copy of HttpRequestMessage.
Declaration
public static Task<HttpRequestMessage> CloneHttpRequestMessage(HttpRequestMessage request)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | The source HttpRequestMessage |
Returns
Type | Description |
---|---|
Task<HttpRequestMessage> | A cloned copy of HttpRequestMessage with exactly the same headers and content. |
EncodeQueryParam(string, object, CollectionFormatType)
Attempts to encode a query param. If it is a list of values, each item in teh list will be encoded and then added to a single string, separated by commas.
Declaration
public static string EncodeQueryParam(string queryKey, object queryParam, CollectionFormatType collectionFormat)
Parameters
Type | Name | Description |
---|---|---|
string | queryKey | The key for the query |
object | queryParam | The query parameter value to encode. |
CollectionFormatType | collectionFormat | The colleciton format to be used to build the query if queryParam contains a list of values. |
Returns
Type | Description |
---|---|
string | The encoded query parameter in string. |
EncodeQueryParamSingleValue(object)
Declaration
public static string EncodeQueryParamSingleValue(object queryParam)
Parameters
Type | Name | Description |
---|---|---|
object | queryParam |
Returns
Type | Description |
---|---|
string |
GenerateRequestID()
Declaration
public static string GenerateRequestID()
Returns
Type | Description |
---|---|
string |
GetEnumString(object)
Gets the actual Enum string representation that will be passed in HTTP request and recognized by service backend.
Declaration
public static string GetEnumString(object enumObject)
Parameters
Type | Name | Description |
---|---|---|
object | enumObject | A query parameter that is an Enum value. |
Returns
Type | Description |
---|---|
string | The matching string representation that can be accepted by service endpoint. |