WebResource class
Creates a new WebResource object.
This class provides an abstraction over a REST call by being library / implementation agnostic and wrapping the necessary properties to initiate a request.
Constructors
Properties
abort |
|
agent |
|
body | |
form |
|
headers | |
keep |
|
method | |
on |
Callback which fires upon download progress. |
on |
Callback which fires upon upload progress. |
operation |
A function that returns the proper OperationResponse for the given OperationSpec and HttpOperationResponse combination. If this is undefined, then a simple status code lookup will be used. |
operation |
|
proxy |
|
query | |
redirect |
|
should |
Whether or not the HttpOperationResponse should be deserialized. If this is undefined, then the HttpOperationResponse should be deserialized. |
stream |
Whether or not the body of the HttpOperationResponse should be treated as a stream. |
timeout | |
url | |
with |
Methods
clone() | Clone this WebResource HTTP request object. |
prepare(Request |
Prepares the request. |
validate |
Validates that the required properties such as method, url, headers["Content-Type"], headers["accept-language"] are defined. It will throw an error if one of the above mentioned properties are not defined. |
Constructor Details
WebResource(string, HttpMethods, any, {[key: string]: any}, HttpHeadersLike | {[key: string]: any}, boolean, boolean, AbortSignalLike, number, (progress: TransferProgressEvent) => void, (progress: TransferProgressEvent) => void, ProxySettings, boolean, AgentSettings, number)
new WebResource(url?: string, method?: HttpMethods, body?: any, query?: {[key: string]: any}, headers?: HttpHeadersLike | {[key: string]: any}, streamResponseBody?: boolean, withCredentials?: boolean, abortSignal?: AbortSignalLike, timeout?: number, onUploadProgress?: (progress: TransferProgressEvent) => void, onDownloadProgress?: (progress: TransferProgressEvent) => void, proxySettings?: ProxySettings, keepAlive?: boolean, agentSettings?: AgentSettings, redirectLimit?: number)
Parameters
- url
-
string
- method
- HttpMethods
- body
-
any
- query
-
{[key: string]: any}
- headers
-
HttpHeadersLike | {[key: string]: any}
- streamResponseBody
-
boolean
- withCredentials
-
boolean
- abortSignal
- AbortSignalLike
- timeout
-
number
- onUploadProgress
-
(progress: TransferProgressEvent) => void
- onDownloadProgress
-
(progress: TransferProgressEvent) => void
- proxySettings
- ProxySettings
- keepAlive
-
boolean
- agentSettings
- AgentSettings
- redirectLimit
-
number
Property Details
abortSignal
agentSettings
body
body?: any
Property Value
any
formData
formData?: any
Property Value
any
headers
keepAlive
keepAlive?: boolean
Property Value
boolean
method
onDownloadProgress
Callback which fires upon download progress.
onDownloadProgress?: (progress: TransferProgressEvent) => void
Property Value
(progress: TransferProgressEvent) => void
onUploadProgress
Callback which fires upon upload progress.
onUploadProgress?: (progress: TransferProgressEvent) => void
Property Value
(progress: TransferProgressEvent) => void
operationResponseGetter
A function that returns the proper OperationResponse for the given OperationSpec and HttpOperationResponse combination. If this is undefined, then a simple status code lookup will be used.
operationResponseGetter?: (operationSpec: OperationSpec, response: HttpOperationResponse) => undefined | OperationResponse
Property Value
(operationSpec: OperationSpec, response: HttpOperationResponse) => undefined | OperationResponse
operationSpec
proxySettings
query
query?: {[key: string]: any}
Property Value
{[key: string]: any}
redirectLimit
redirectLimit?: number
Property Value
number
shouldDeserialize
Whether or not the HttpOperationResponse should be deserialized. If this is undefined, then the HttpOperationResponse should be deserialized.
shouldDeserialize?: boolean | (response: HttpOperationResponse) => boolean
Property Value
boolean | (response: HttpOperationResponse) => boolean
streamResponseBody
Whether or not the body of the HttpOperationResponse should be treated as a stream.
streamResponseBody?: boolean
Property Value
boolean
timeout
timeout: number
Property Value
number
url
url: string
Property Value
string
withCredentials
withCredentials: boolean
Property Value
boolean
Method Details
clone()
Clone this WebResource HTTP request object.
function clone(): WebResource
Returns
The clone of this WebResource HTTP request object.
prepare(RequestPrepareOptions)
Prepares the request.
function prepare(options: RequestPrepareOptions): WebResource
Parameters
- options
- RequestPrepareOptions
Options to provide for preparing the request.
Returns
Returns the prepared WebResource (HTTP Request) object that needs to be given to the request pipeline.
validateRequestProperties()
Validates that the required properties such as method, url, headers["Content-Type"], headers["accept-language"] are defined. It will throw an error if one of the above mentioned properties are not defined.
function validateRequestProperties()
Azure SDK for JavaScript