Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebResource

Package version

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.

constructor

Hierarchy

  • WebResource

Index

Constructors

constructor

  • new WebResource(url?: undefined | string, method?: HttpMethods, body?: any, query?: undefined | object, headers?: object | HttpHeaders, streamResponseBody?: undefined | false | true, withCredentials?: undefined | false | true, abortSignal?: AbortSignalLike, timeout?: undefined | number, onUploadProgress?: undefined | function, onDownloadProgress?: undefined | function, proxySettings?: ProxySettings, keepAlive?: undefined | false | true): WebResource
  • Parameters

    • Optional url: undefined | string
    • Optional method: HttpMethods
    • Optional body: any
    • Optional query: undefined | object
    • Optional headers: object | HttpHeaders
    • Optional streamResponseBody: undefined | false | true
    • Optional withCredentials: undefined | false | true
    • Optional abortSignal: AbortSignalLike
    • Optional timeout: undefined | number
    • Optional onUploadProgress: undefined | function
    • Optional onDownloadProgress: undefined | function
    • Optional proxySettings: ProxySettings
    • Optional keepAlive: undefined | false | true

    Returns WebResource

Properties

Optional abortSignal

abortSignal: AbortSignalLike

Optional body

body: any

Optional formData

formData: any

headers

headers: HttpHeaders

Optional keepAlive

keepAlive: undefined | false | true

method

method: HttpMethods

Optional onDownloadProgress

onDownloadProgress: undefined | function

Callback which fires upon download progress.

Optional onUploadProgress

onUploadProgress: undefined | function

Callback which fires upon upload progress.

Optional operationResponseGetter

operationResponseGetter: undefined | function

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.

Optional operationSpec

operationSpec: OperationSpec

Optional proxySettings

proxySettings: ProxySettings

Optional query

query: undefined | object

Optional shouldDeserialize

shouldDeserialize: boolean | function

Whether or not the HttpOperationResponse should be deserialized. If this is undefined, then the HttpOperationResponse should be deserialized.

Optional spanOptions

spanOptions: SpanOptions

Options used to create a span when tracing is enabled.

Optional streamResponseBody

streamResponseBody: undefined | false | true

Whether or not the body of the HttpOperationResponse should be treated as a stream.

timeout

timeout: number

url

url: string

withCredentials

withCredentials: boolean

Methods

clone

  • Clone this WebResource HTTP request object.

    Returns WebResource

    The clone of this WebResource HTTP request object.

prepare

  • Prepares the request.

    Parameters

    Returns WebResource

    Returns the prepared WebResource (HTTP Request) object that needs to be given to the request pipeline.

validateRequestProperties

  • validateRequestProperties(): void
  • 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.

    Returns void

Generated using TypeDoc