你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

RequestPrepareOptions interface

属性

abortSignal
baseUrl

请求的基 URL。 默认值为:“https://management.azure.com"。 这仅适用于 pathTemplate。 如果要提供 options.url,则预期提供完整的 URL。

body

请求正文。 它可以是任何类型的。 如果此值不是流,则会对其进行序列化。

bodyIsStream

指示请求正文是否为流(适用于文件上传方案)。

deserializationMapper

提供有关如何反序列化响应正文的信息。

disableClientRequestId

如果设置为 true,则指示客户端不要将“x-ms-client-request-id”标头设置为新的 Guid()。

disableJsonStringifyOnBody

指示此方法是否应为请求正文 JSON.stringify()。 默认值:false。

formData
headers

需要应用于请求的请求标头的字典。 此处的键是“header-name”,值为“header-value”。 标头值必须是字符串类型。

  • ContentType 必须以密钥名称作为“Content-Type”提供。 默认值“application/json;charset=utf-8”。
  • 如果“options.bodyIsStream”设置为 true,则默认情况下,“Transfer-Encoding”设置为“分块”。
  • 如果“options.bodyIsStream”设置为 true,则默认情况下,“Content-Type”设置为“application/octet-stream”。
  • 默认情况下,“accept-language”设置为“en-US”
  • 默认情况下,“x-ms-client-request-id”设置为新的 Guid。 若要不为请求生成 guid,请将 options.disableClientRequestId 设置为 true
mappers

一个映射器的字典,可在 [de]序列化时使用。

method

HTTP 请求方法。 有效值为“GET”、“PUT”、“HEAD”、“DELETE”、“OPTIONS”、“POST”或“PATCH”。

onDownloadProgress
onUploadProgress
pathParameters

需要替换为 pathTemplate 中实际值的路径参数字典。 此处的键是“path-parameter-name”,值为“path-parameter-value”。 “path-parameter-value”可以是“string”类型,也可以是“object”类型。 如果要跳过 URL 编码,应使用“object”格式。 使用对象格式时,该对象必须具有提供“path-parameter-value”的属性命名值。 例:

  • 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

请求 URL 的路径模板。 提供“url”或在 options 对象中提供“pathTemplate”。 这两个选项都是互斥的。 示例:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}”

queryParameters

要追加到 URL 的查询参数字典,其中“key”是“query-parameter-name”,“value”是“query-parameter-value”。 “query-parameter-value”可以是“string”类型,也可以是“object”类型。 如果要跳过 URL 编码,应使用“object”格式。 使用对象格式时,该对象必须具有提供“query-parameter-value”的属性命名值。 例:

  • 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”}. 注意:“如果 options.url 已有一些查询参数,则 options.queryParameters 中提供的值将追加到 URL。
redirectLimit

限制此请求后跟的重定向数。 如果设置为 0,则不会跟踪重定向。 如果未定义,基础node_fetch的默认重定向行为将适用。

serializationMapper

提供有关如何序列化请求正文的信息。

streamResponseBody
url

请求 URL。 它可能包含查询参数,也可能没有查询参数。 提供“url”或在 options 对象中提供“pathTemplate”。 这两个选项都是互斥的。

属性详细信息

abortSignal

abortSignal?: AbortSignalLike

属性值

baseUrl

请求的基 URL。 默认值为:“https://management.azure.com"。 这仅适用于 pathTemplate。 如果要提供 options.url,则预期提供完整的 URL。

baseUrl?: string

属性值

string

body

请求正文。 它可以是任何类型的。 如果此值不是流,则会对其进行序列化。

body?: any

属性值

any

bodyIsStream

指示请求正文是否为流(适用于文件上传方案)。

bodyIsStream?: boolean

属性值

boolean

deserializationMapper

提供有关如何反序列化响应正文的信息。

deserializationMapper?: object

属性值

object

disableClientRequestId

如果设置为 true,则指示客户端不要将“x-ms-client-request-id”标头设置为新的 Guid()。

disableClientRequestId?: boolean

属性值

boolean

disableJsonStringifyOnBody

指示此方法是否应为请求正文 JSON.stringify()。 默认值:false。

disableJsonStringifyOnBody?: boolean

属性值

boolean

formData

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

属性值

{[key: string]: any}

headers

需要应用于请求的请求标头的字典。 此处的键是“header-name”,值为“header-value”。 标头值必须是字符串类型。

  • ContentType 必须以密钥名称作为“Content-Type”提供。 默认值“application/json;charset=utf-8”。
  • 如果“options.bodyIsStream”设置为 true,则默认情况下,“Transfer-Encoding”设置为“分块”。
  • 如果“options.bodyIsStream”设置为 true,则默认情况下,“Content-Type”设置为“application/octet-stream”。
  • 默认情况下,“accept-language”设置为“en-US”
  • 默认情况下,“x-ms-client-request-id”设置为新的 Guid。 若要不为请求生成 guid,请将 options.disableClientRequestId 设置为 true
headers?: {[key: string]: any}

属性值

{[key: string]: any}

mappers

一个映射器的字典,可在 [de]序列化时使用。

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

属性值

{[x: string]: any}

method

HTTP 请求方法。 有效值为“GET”、“PUT”、“HEAD”、“DELETE”、“OPTIONS”、“POST”或“PATCH”。

method: HttpMethods

属性值

onDownloadProgress

onDownloadProgress?: (progress: TransferProgressEvent) => void

属性值

(progress: TransferProgressEvent) => void

onUploadProgress

onUploadProgress?: (progress: TransferProgressEvent) => void

属性值

(progress: TransferProgressEvent) => void

pathParameters

需要替换为 pathTemplate 中实际值的路径参数字典。 此处的键是“path-parameter-name”,值为“path-parameter-value”。 “path-parameter-value”可以是“string”类型,也可以是“object”类型。 如果要跳过 URL 编码,应使用“object”格式。 使用对象格式时,该对象必须具有提供“path-parameter-value”的属性命名值。 例:

  • 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}

属性值

{[key: string]: any | ParameterValue}

pathTemplate

请求 URL 的路径模板。 提供“url”或在 options 对象中提供“pathTemplate”。 这两个选项都是互斥的。 示例:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}”

pathTemplate?: string

属性值

string

queryParameters

要追加到 URL 的查询参数字典,其中“key”是“query-parameter-name”,“value”是“query-parameter-value”。 “query-parameter-value”可以是“string”类型,也可以是“object”类型。 如果要跳过 URL 编码,应使用“object”格式。 使用对象格式时,该对象必须具有提供“query-parameter-value”的属性命名值。 例:

  • 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”}. 注意:“如果 options.url 已有一些查询参数,则 options.queryParameters 中提供的值将追加到 URL。
queryParameters?: {[key: string]: any | ParameterValue}

属性值

{[key: string]: any | ParameterValue}

redirectLimit

限制此请求后跟的重定向数。 如果设置为 0,则不会跟踪重定向。 如果未定义,基础node_fetch的默认重定向行为将适用。

redirectLimit?: number

属性值

number

serializationMapper

提供有关如何序列化请求正文的信息。

serializationMapper?: Mapper

属性值

streamResponseBody

streamResponseBody?: boolean

属性值

boolean

url

请求 URL。 它可能包含查询参数,也可能没有查询参数。 提供“url”或在 options 对象中提供“pathTemplate”。 这两个选项都是互斥的。

url?: string

属性值

string