Ads API .NET library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Google.Api.Ads.Common.Util.HttpUtilities Class Reference

Utility class for various HTTP tasks. More...

Static Public Member Functions

static WebRequest BuildRangeRequest (string url, int contentLength, string range, AppConfig config)
 Builds an HTTP PUT request with a Range header. More...
 
static WebRequest BuildRequest (string url, string method, AppConfig config)
 Builds an HTTP request with a specified method. More...
 
static string GetErrorResponseBody (WebException e)
 Gets the error response body. More...
 
static void WritePostBodyAndLog (WebRequest request, string postBody, string service, LogEntry logEntry, ISet< string > headersToMask)
 Attempts to write a post body and log the request. More...
 
static string UpdateEndpointHostInUrl (string originalUri, string newHost)
 Updates a URL endpoint with a new host. More...
 

Detailed Description

Utility class for various HTTP tasks.

Member Function Documentation

static WebRequest Google.Api.Ads.Common.Util.HttpUtilities.BuildRangeRequest ( string  url,
int  contentLength,
string  range,
AppConfig  config 
)
inlinestatic

Builds an HTTP PUT request with a Range header.

Parameters
urlThe URL.
contentLengthLength of the content.
rangeThe range heaer notation.
configThe configuration instance for customizing the connection settings.
Returns
The web request for making HTTP call.
Exceptions
System.ArgumentNullExceptionThrown if config is null.

Referenced by Google.Api.Ads.AdWords.Util.BatchJob.BatchJobUtilitiesBase.UploadChunk().

static WebRequest Google.Api.Ads.Common.Util.HttpUtilities.BuildRequest ( string  url,
string  method,
AppConfig  config 
)
inlinestatic

Builds an HTTP request with a specified method.

Parameters
urlThe URL.
methodThe HTTP method.
configThe configuration instance for customizing the connection settings.
Returns
The web request for making HTTP call.
Exceptions
System.ArgumentNullExceptionThrown if config is null.

References Google.Api.Ads.Common.Lib.AppConfig.EnableGzipCompression.

static string Google.Api.Ads.Common.Util.HttpUtilities.GetErrorResponseBody ( WebException  e)
inlinestatic

Gets the error response body.

Parameters
eThe web exception.
Returns
static string Google.Api.Ads.Common.Util.HttpUtilities.UpdateEndpointHostInUrl ( string  originalUri,
string  newHost 
)
inlinestatic

Updates a URL endpoint with a new host.

Parameters
originalUriThe original URI.
newHostThe new host.
Returns
The updated URL.
static void Google.Api.Ads.Common.Util.HttpUtilities.WritePostBodyAndLog ( WebRequest  request,
string  postBody,
string  service,
LogEntry  logEntry,
ISet< string >  headersToMask 
)
inlinestatic

Attempts to write a post body and log the request.

Parameters
requestThe request.
postBodyThe post body.
serviceThe service making this request.
logEntryThe log entry.
headersToMaskThe headers to mask.

The documentation for this class was generated from the following file: