RequestPrepareOptions interface

Options to prepare an outgoing HTTP request.

Properties

abortSignal

Signal of an abort controller. Can be used to abort both sending a network request and waiting for a response.

baseUrl

The base url of the request. Default value is: "https://management.azure.com". This is applicable only with pathTemplate. If you are providing options.url then it is expected that you provide the complete url.

body

The request body. It can be of any type. This value will be serialized if it is not a stream.

bodyIsStream

Indicates whether the request body is a stream (useful for file upload scenarios).

deserializationMapper

Provides information on how to deserialize the response body.

disableClientRequestId

When set to true, instructs the client to not set "x-ms-client-request-id" header to a new Guid().

disableJsonStringifyOnBody

Indicates whether this method should JSON.stringify() the request body. Default value: false.

formData

Form data, used to build the request body.

headers

A dictionary of request headers that need to be applied to the request. Here the key is the "header-name" and the value is the "header-value". The header-value MUST be of type string.

  • ContentType must be provided with the key name as "Content-Type". Default value "application/json; charset=utf-8".
  • "Transfer-Encoding" is set to "chunked" by default if "options.bodyIsStream" is set to true.
  • "Content-Type" is set to "application/octet-stream" by default if "options.bodyIsStream" is set to true.
  • "accept-language" by default is set to "en-US"
  • "x-ms-client-request-id" by default is set to a new Guid. To not generate a guid for the request, please set options.disableClientRequestId to true
mappers

A dictionary of mappers that may be used while [de]serialization.

method

The HTTP request method. Valid values are "GET", "PUT", "HEAD", "DELETE", "OPTIONS", "POST", or "PATCH".

onDownloadProgress

Allows keeping track of the progress of downloading the incoming response.

onUploadProgress

Allows keeping track of the progress of uploading the outgoing request.

pathParameters

A dictionary of path parameters that need to be replaced with actual values in the pathTemplate. Here the key is the "path-parameter-name" and the value is the "path-parameter-value". The "path-parameter-value" can be of type "string" or it can be of type "object". The "object" format should be used when you want to skip url encoding. While using the object format, the object must have a property named value which provides the "path-parameter-value". Example:

  • path-parameter-value in "object" format: { "path-parameter-name": { value: "path-parameter-value", skipUrlEncoding: true } }
  • path-parameter-value in "string" format: { "path-parameter-name": "path-parameter-value" }.
pathTemplate

The path template of the request url. Either provide the "url" or provide the "pathTemplate" in the options object. Both the options are mutually exclusive. Example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}

queryParameters

A dictionary of query parameters to be appended to the url, where the "key" is the "query-parameter-name" and the "value" is the "query-parameter-value". The "query-parameter-value" can be of type "string" or it can be of type "object". The "object" format should be used when you want to skip url encoding. While using the object format, the object must have a property named value which provides the "query-parameter-value". Example:

  • query-parameter-value in "object" format: { "query-parameter-name": { value: "query-parameter-value", skipUrlEncoding: true } }
  • query-parameter-value in "string" format: { "query-parameter-name": "query-parameter-value"}. Note: "If options.url already has some query parameters, then the value provided in options.queryParameters will be appended to the url.
serializationMapper

Provides information on how to serialize the request body.

spanOptions

Tracing: Options used to create a span when tracing is enabled.

tracingContext

Tracing: Context used when creating spans.

url

The request url. It may or may not have query parameters in it. Either provide the "url" or provide the "pathTemplate" in the options object. Both the options are mutually exclusive.

Property Details

abortSignal

Signal of an abort controller. Can be used to abort both sending a network request and waiting for a response.

abortSignal?: AbortSignalLike

Property Value

baseUrl

The base url of the request. Default value is: "https://management.azure.com". This is applicable only with pathTemplate. If you are providing options.url then it is expected that you provide the complete url.

baseUrl?: string

Property Value

string

body

The request body. It can be of any type. This value will be serialized if it is not a stream.

body?: any

Property Value

any

bodyIsStream

Indicates whether the request body is a stream (useful for file upload scenarios).

bodyIsStream?: boolean

Property Value

boolean

deserializationMapper

Provides information on how to deserialize the response body.

deserializationMapper?: Record<string, unknown>

Property Value

Record<string, unknown>

disableClientRequestId

When set to true, instructs the client to not set "x-ms-client-request-id" header to a new Guid().

disableClientRequestId?: boolean

Property Value

boolean

disableJsonStringifyOnBody

Indicates whether this method should JSON.stringify() the request body. Default value: false.

disableJsonStringifyOnBody?: boolean

Property Value

boolean

formData

Form data, used to build the request body.

formData?: {[key: string]: any}

Property Value

{[key: string]: any}

headers

A dictionary of request headers that need to be applied to the request. Here the key is the "header-name" and the value is the "header-value". The header-value MUST be of type string.

  • ContentType must be provided with the key name as "Content-Type". Default value "application/json; charset=utf-8".
  • "Transfer-Encoding" is set to "chunked" by default if "options.bodyIsStream" is set to true.
  • "Content-Type" is set to "application/octet-stream" by default if "options.bodyIsStream" is set to true.
  • "accept-language" by default is set to "en-US"
  • "x-ms-client-request-id" by default is set to a new Guid. To not generate a guid for the request, please set options.disableClientRequestId to true
headers?: {[key: string]: any}

Property Value

{[key: string]: any}

mappers

A dictionary of mappers that may be used while [de]serialization.

mappers?: {[x: string]: any}

Property Value

{[x: string]: any}

method

The HTTP request method. Valid values are "GET", "PUT", "HEAD", "DELETE", "OPTIONS", "POST", or "PATCH".

method: HttpMethods

Property Value

onDownloadProgress

Allows keeping track of the progress of downloading the incoming response.

onDownloadProgress?: (progress: TransferProgressEvent) => void

Property Value

(progress: TransferProgressEvent) => void

onUploadProgress

Allows keeping track of the progress of uploading the outgoing request.

onUploadProgress?: (progress: TransferProgressEvent) => void

Property Value

(progress: TransferProgressEvent) => void

pathParameters

A dictionary of path parameters that need to be replaced with actual values in the pathTemplate. Here the key is the "path-parameter-name" and the value is the "path-parameter-value". The "path-parameter-value" can be of type "string" or it can be of type "object". The "object" format should be used when you want to skip url encoding. While using the object format, the object must have a property named value which provides the "path-parameter-value". Example:

  • path-parameter-value in "object" format: { "path-parameter-name": { value: "path-parameter-value", skipUrlEncoding: true } }
  • path-parameter-value in "string" format: { "path-parameter-name": "path-parameter-value" }.
pathParameters?: {[key: string]: any | ParameterValue}

Property Value

{[key: string]: any | ParameterValue}

pathTemplate

The path template of the request url. Either provide the "url" or provide the "pathTemplate" in the options object. Both the options are mutually exclusive. Example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}

pathTemplate?: string

Property Value

string

queryParameters

A dictionary of query parameters to be appended to the url, where the "key" is the "query-parameter-name" and the "value" is the "query-parameter-value". The "query-parameter-value" can be of type "string" or it can be of type "object". The "object" format should be used when you want to skip url encoding. While using the object format, the object must have a property named value which provides the "query-parameter-value". Example:

  • query-parameter-value in "object" format: { "query-parameter-name": { value: "query-parameter-value", skipUrlEncoding: true } }
  • query-parameter-value in "string" format: { "query-parameter-name": "query-parameter-value"}. Note: "If options.url already has some query parameters, then the value provided in options.queryParameters will be appended to the url.
queryParameters?: {[key: string]: any | ParameterValue}

Property Value

{[key: string]: any | ParameterValue}

serializationMapper

Provides information on how to serialize the request body.

serializationMapper?: Mapper

Property Value

spanOptions

Tracing: Options used to create a span when tracing is enabled.

spanOptions?: SpanOptions

Property Value

@azure/core-tracing.SpanOptions

tracingContext

Tracing: Context used when creating spans.

tracingContext?: Context

Property Value

@azure/core-tracing.Context

url

The request url. It may or may not have query parameters in it. Either provide the "url" or provide the "pathTemplate" in the options object. Both the options are mutually exclusive.

url?: string

Property Value

string