C# Class IBM.Cloudant.Client.HttpHelper

Internal class to manage the HTTP connection.
This class is used to manage HTTP requests and responses.
Afficher le fichier Open project: cloudant/xamarin-cloudant Class Usage Examples

Méthodes publiques

Méthode Description
AddGlobalHeader ( string name, string value ) : void

Adds global headers to the HttpClient.

DeleteAsync ( Uri uri, String>.Dictionary headers ) : Task

Sends an Http DELETE request to the given URI using the given headers.

GetAsync ( Uri uri, String>.Dictionary headers ) : Task

Sends a sends a HTTP GET request to the specified endpoint. Endpoint to send the request to. Additional headers to pass for the request

HttpHelper ( Uri baseUri ) : System

Initializes a new instance of the IBM.Cloudant.Client.HttpHelper class.

HttpHelper ( Uri baseUri, List requestInterceptors, List responseInterceptors ) : System

Initializes a new instance of the IBM.Cloudant.Client.HttpHelper class.

PostAsync ( Uri uri, String>.Dictionary headers, string body ) : Task

Sends an Http POST request to the given URI using the given headers and content.

PutAsync ( Uri uri, String>.Dictionary headers, string body ) : Task

Sends an Http PUT request to the given URI using the given headers and content.

RemoveGlobalHeader ( string name ) : void

Removes a header from the HttpClient global headers.

SetNumberOfRetries ( int numberOfRetries ) : void

Maximum number of times to rety a request when it has been intercepted and any interceptor sets the IBM.Cloudant.Client.HttpConnectionInterceptorContext.replayRequest flag to true.

Private Methods

Méthode Description
FormatAndSanitizeHeaders ( HttpHeaders headers ) : string

Removes password from Authentication header for safe logging.

FormatHttpRequestLog ( HttpRequestMessage request ) : string
FormatHttpResponseLog ( HttpResponseMessage response ) : string
FormatProperties ( object>.IDictionary props ) : string
SendJSONRequestAsync ( HttpMethod method, Uri uri, string>.Dictionary headers, string body ) : Task
SendRequestAsync ( HttpMethod method, Uri uri, string>.Dictionary headers, HttpContent content ) : Task

Method Details

AddGlobalHeader() public méthode

Adds global headers to the HttpClient.
public AddGlobalHeader ( string name, string value ) : void
name string Header name.
value string Header value.
Résultat void

DeleteAsync() public méthode

Sends an Http DELETE request to the given URI using the given headers.
public DeleteAsync ( Uri uri, String>.Dictionary headers ) : Task
uri System.Uri URI for this request.
headers String>.Dictionary Http headers for this request.
Résultat Task

GetAsync() public méthode

Sends a sends a HTTP GET request to the specified endpoint. Endpoint to send the request to. Additional headers to pass for the request
public GetAsync ( Uri uri, String>.Dictionary headers ) : Task
uri System.Uri
headers String>.Dictionary
Résultat Task

HttpHelper() public méthode

Initializes a new instance of the IBM.Cloudant.Client.HttpHelper class.
public HttpHelper ( Uri baseUri ) : System
baseUri System.Uri Base URI for the HttpClient in this helper. All http requests must be relative to this URI.
Résultat System

HttpHelper() public méthode

Initializes a new instance of the IBM.Cloudant.Client.HttpHelper class.
public HttpHelper ( Uri baseUri, List requestInterceptors, List responseInterceptors ) : System
baseUri System.Uri Base URI for the HttpClient in this helper. All http requests must be relative to this URI.
requestInterceptors List Request interceptors.
responseInterceptors List Response interceptors.
Résultat System

PostAsync() public méthode

Sends an Http POST request to the given URI using the given headers and content.
public PostAsync ( Uri uri, String>.Dictionary headers, string body ) : Task
uri System.Uri URI for this request.
headers String>.Dictionary Http headers for this request.
body string The request contents.
Résultat Task

PutAsync() public méthode

Sends an Http PUT request to the given URI using the given headers and content.
public PutAsync ( Uri uri, String>.Dictionary headers, string body ) : Task
uri System.Uri URI for this request.
headers String>.Dictionary Http headers for this request.
body string The request contents.
Résultat Task

RemoveGlobalHeader() public méthode

Removes a header from the HttpClient global headers.
public RemoveGlobalHeader ( string name ) : void
name string Name.
Résultat void

SetNumberOfRetries() public méthode

Maximum number of times to rety a request when it has been intercepted and any interceptor sets the IBM.Cloudant.Client.HttpConnectionInterceptorContext.replayRequest flag to true.
public SetNumberOfRetries ( int numberOfRetries ) : void
numberOfRetries int Number of retries.
Résultat void