Options
All
  • Public
  • Public/Protected
  • All
Menu

@azure/core-http

Package version

Index

Modules

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

Authenticator

Authenticator: (challenge: unknown) => Promise<string>

Type declaration

    • (challenge: unknown): Promise<string>
    • Parameters

      • challenge: unknown

      Returns Promise<string>

CommonRequestInfo

CommonRequestInfo: string

CommonRequestInit

CommonRequestInit: Omit<RequestInit, "body" | "headers" | "signal"> & { body?: any; headers?: any; signal?: any }

CommonResponse

CommonResponse: Omit<Response, "body" | "trailer" | "formData"> & { body: any; formData: any; trailer: any }

HttpMethods

HttpMethods: "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE"

HttpRequestBody

HttpRequestBody: Blob | string | ArrayBuffer | ArrayBufferView | (() => NodeJS.ReadableStream)

Mapper

MapperType

OperationTracingOptions

OperationTracingOptions: OperationOptions["tracingOptions"]

ParameterPath

ParameterPath: string | string[] | {}

PropertyParent

PropertyParent: {}

Type declaration

  • [propertyName: string]: any

ProxyAgent

ProxyAgent: { agent: http.Agent | https.Agent; isHttps: boolean }

Type declaration

  • agent: http.Agent | https.Agent
  • isHttps: boolean

ProxyOptions

ProxyOptions: ProxySettings

RawHttpHeaders

RawHttpHeaders: {}

A HttpHeaders collection represented as a simple JSON object.

Type declaration

  • [headerName: string]: string

RequestPolicyFactory

RequestPolicyFactory: { create: any }

Creates a new RequestPolicy per-request that uses the provided nextPolicy.

Type declaration

ResponseHandler

ResponseHandler: (httpRequest: WebResourceLike, response: HttpOperationResponse) => Promise<HttpOperationResponse>

Type declaration

TelemetryInfo

TelemetryInfo: { key?: undefined | string; value?: undefined | string }

Type declaration

  • Optional key?: undefined | string
  • Optional value?: undefined | string

TransferProgressEvent

TransferProgressEvent: { loadedBytes: number }

Fired in response to upload or download progress.

Type declaration

  • loadedBytes: number

    The number of bytes loaded so far.

URLQueryParseState

URLQueryParseState: "ParameterName" | "ParameterValue"

URLTokenType

URLTokenType: "SCHEME" | "HOST" | "PORT" | "PATH" | "QUERY"

URLTokenizerState

URLTokenizerState: "SCHEME" | "SCHEME_OR_HOST" | "HOST" | "PORT" | "PATH" | "QUERY" | "DONE"

Variables

Const DEFAULT_AUTHORIZATION_SCHEME

DEFAULT_AUTHORIZATION_SCHEME: "Basic" = "Basic"

Const DEFAULT_CLIENT_MAX_RETRY_INTERVAL

DEFAULT_CLIENT_MAX_RETRY_INTERVAL: number = 1000 * 90

Const DEFAULT_CLIENT_MIN_RETRY_INTERVAL

DEFAULT_CLIENT_MIN_RETRY_INTERVAL: number = 1000 * 3

Const DEFAULT_CLIENT_RETRY_COUNT

DEFAULT_CLIENT_RETRY_COUNT: 3 = 3

Const DEFAULT_CLIENT_RETRY_INTERVAL

DEFAULT_CLIENT_RETRY_INTERVAL: number = 1000 * 30

Const DisbleResponseDecompressionNotSupportedInBrowser

DisbleResponseDecompressionNotSupportedInBrowser: any = new Error("DisableResponseDecompressionPolicy is not supported in browser environment")

Const HeaderConstants

HeaderConstants: { AUTHORIZATION: string; AUTHORIZATION_SCHEME: string; RETRY_AFTER: string; USER_AGENT: string } = Constants.HeaderConstants

Type declaration

  • AUTHORIZATION: string

    The Authorization header.

  • AUTHORIZATION_SCHEME: string
  • RETRY_AFTER: string

    The Retry-After response-header field can be used with a 503 (Service Unavailable) or 349 (Too Many Requests) responses to indicate how long the service is expected to be unavailable to the requesting client.

  • USER_AGENT: string

    The UserAgent header.

Const MapperType

MapperType: {} = strEnum(["Base64Url","Boolean","ByteArray","Composite","Date","DateTime","DateTimeRfc1123","Dictionary","Enum","Number","Object","Sequence","String","Stream","TimeSpan","UnixTime"])

Type declaration

Const RedactedString

RedactedString: "REDACTED" = "REDACTED"

Const StatusCodes

StatusCodes: { TooManyRequests: number } = Constants.HttpConstants.StatusCodes

Type declaration

  • TooManyRequests: number

Const TokenRefreshBufferMs

TokenRefreshBufferMs: number = 2 * 60 * 1000

Defines the default token refresh buffer duration.

Const XML_ATTRKEY

XML_ATTRKEY: "$" = "$"

Default key used to access the XML attributes.

Const XML_CHARKEY

XML_CHARKEY: "_" = "_"

Default key used to access the XML value content.

Const allowedRedirect

allowedRedirect: Object = ["GET", "HEAD"]

Methods that are allowed to follow redirects 301 and 302

Const byPassedList

byPassedList: Map<string, boolean> = new Map()

Let cachedHttpClient

cachedHttpClient: HttpClient | undefined

Const custom

custom: {} = inspect.custom

Type declaration

Const defaultAllowedHeaderNames

defaultAllowedHeaderNames: Object = ["x-ms-client-request-id","x-ms-return-client-request-id","x-ms-useragent","x-ms-correlation-request-id","x-ms-request-id","client-request-id","return-client-request-id","traceparent","Access-Control-Allow-Credentials","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Allow-Origin","Access-Control-Expose-Headers","Access-Control-Max-Age","Access-Control-Request-Headers","Access-Control-Request-Method","Origin","Accept","Cache-Control","Connection","Content-Length","Content-Type","Date","ETag","Expires","If-Match","If-Modified-Since","If-None-Match","If-Unmodified-Since","Last-Modified","Pragma","Request-Id","Retry-After","Server","Transfer-Encoding","User-Agent"]

Const defaultAllowedQueryParameters

defaultAllowedQueryParameters: string[] = ["api-version"]

Const defaultJsonContentTypes

defaultJsonContentTypes: Object = ["application/json", "text/json"]

Const defaultXmlContentTypes

defaultXmlContentTypes: Object = ["application/xml", "application/atom+xml"]

Const doc

doc: Document = document.implementation.createDocument(null, null, null)

Let errorNS

errorNS: string = ""

Const errorSanitizer

errorSanitizer: Sanitizer = new Sanitizer()

Const getDefaultUserAgentHeaderName

getDefaultUserAgentHeaderName: getDefaultUserAgentKey = getDefaultUserAgentKey

Let isNoProxyInitalized

isNoProxyInitalized: boolean = false

Const isNode

isNode: boolean = typeof process !== "undefined" &&!!process.version &&!!process.versions &&!!process.versions.node

A constant that indicates whether the environment is node.js or browser based.

Const logger

logger: any = createClientLogger("core-http")

Let noProxyList

noProxyList: string[] = []

Const parser

parser: DOMParser = new DOMParser()

Const proxyNotSupportedInBrowser

proxyNotSupportedInBrowser: any = new Error("ProxyPolicy is not supported in browser environment")

Const serializer

serializer: XMLSerializer = new XMLSerializer()

Const timeBetweenRefreshAttemptsInMs

timeBetweenRefreshAttemptsInMs: 30000 = 30000

The automated token refresh will only start to happen at the expiration date minus the value of timeBetweenRefreshAttemptsInMs, which is by default 30 seconds.

Const url

url: { constructor: any; prototype: __type; createObjectURL: any; revokeObjectURL: any } = URL

Type declaration

  • constructor: function
    • Parameters

      • url: string
      • Optional base: string | __type

      Returns __type

  • prototype: __type
  • createObjectURL: function
    • createObjectURL(object: any): string
    • Parameters

      • object: any

      Returns string

  • revokeObjectURL: function
    • revokeObjectURL(url: string): void
    • Parameters

      • url: string

      Returns void

Const validUuidRegex

validUuidRegex: Object = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i

Const validateISODuration

validateISODuration: Object = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/

Const xml2jsBuilderSettings

xml2jsBuilderSettings: any = Object.assign({}, xml2jsDefaultOptionsV2)

Const xml2jsParserSettings

xml2jsParserSettings: any = Object.assign({}, xml2jsDefaultOptionsV2)

Functions

addProgressListener

  • addProgressListener(xhr: XMLHttpRequestEventTarget, listener?: undefined | ((progress: TransferProgressEvent) => void)): void

applyMixins

  • applyMixins(targetCtorParam: unknown, sourceCtors: any[]): void
  • Applies the properties on the prototype of sourceCtors to the prototype of targetCtor

    Parameters

    • targetCtorParam: unknown
    • sourceCtors: any[]

      An array of source objects from which the properties need to be taken.

    Returns void

asElementWithAttributes

  • asElementWithAttributes(node: Node): Element | undefined

base64UrlToByteArray

  • base64UrlToByteArray(str: string): Uint8Array | undefined

bearerTokenAuthenticationPolicy

  • bearerTokenAuthenticationPolicy(credential: TokenCredential, scopes: string | string[]): RequestPolicyFactory

bufferToBase64Url

  • bufferToBase64Url(buffer: any): string | undefined

buildAttributes

  • buildAttributes(attrs: {}): Attr[]

buildNode

  • buildNode(obj: any, elementName: string, options: Required<SerializerOptions>): Node[]

checkRPNotRegisteredError

  • checkRPNotRegisteredError(body: string): string
  • Validates the error code and message associated with 409 response status code. If it matches to that of RP not registered then it returns the name of the RP else returns undefined.

    Parameters

    • body: string

      The response body received after making the original request.

    Returns string

    The name of the RP if condition is satisfied else undefined.

createDefaultRequestPolicyFactories

createPipelineFromOptions

createProxyAgent

createTunnel

  • createTunnel(isRequestHttps: boolean, isProxyHttps: boolean, tunnelOptions: tunnel.HttpsOverHttpsOptions): http.Agent | https.Agent

dateToUnixTime

  • dateToUnixTime(d: string | Date): number | undefined

decodeString

  • decodeString(value: string): Uint8Array

delay

  • delay<T>(t: number, value?: T): Promise<T | void>
  • A wrapper for setTimeout that resolves a promise after t milliseconds.

    Type parameters

    • T

    Parameters

    • t: number

      The number of milliseconds to be delayed.

    • Optional value: T

      The value to be resolved with after a timeout of t milliseconds.

    Returns Promise<T | void>

    Resolved promise

deserializationPolicy

deserializeCompositeType

deserializeDictionaryType

deserializeResponseBody

deserializeSequenceType

disableResponseDecompressionPolicy

domToObject

encodeByteArray

  • encodeByteArray(value: Uint8Array): string

encodeString

  • encodeString(value: string): string

encodeUri

  • encodeUri(uri: string): string

executePromisesSequentially

  • executePromisesSequentially(promiseFactories: Array<any>, kickstart: unknown): Promise<any>

exponentialRetryPolicy

  • exponentialRetryPolicy(retryCount?: undefined | number, retryInterval?: undefined | number, maxRetryInterval?: undefined | number): RequestPolicyFactory

extractAuthFromUrl

  • extractAuthFromUrl(url: string): { password?: undefined | string; urlWithoutAuth: string; username?: undefined | string }

extractSubscriptionUrl

  • extractSubscriptionUrl(url: string): string

flattenResponse

generateClientRequestIdPolicy

generateUuid

  • generateUuid(): string

getCachedAgent

  • getCachedAgent(isHttps: boolean, agentCache: AgentCache): http.Agent | https.Agent | undefined

getCachedDefaultHttpClient

getCredentialScopes

  • getCredentialScopes(options?: ServiceClientOptions, baseUri?: undefined | string): string | string[] | undefined

getCurrentCharacter

getDefaultProxySettings

  • getDefaultProxySettings(proxyUrl?: undefined | string): ProxySettings | undefined

getDefaultUserAgentKey

  • getDefaultUserAgentKey(): string

getDefaultUserAgentValue

  • getDefaultUserAgentValue(): string

getEnvironmentValue

  • getEnvironmentValue(name: string): string | undefined

getHeaderKey

  • getHeaderKey(headerName: string): string

getOperationArgumentValueFromParameter

getOperationArgumentValueFromParameterPath

getOperationResponse

getPathStringFromParameter

getPathStringFromParameterPath

getPlatformSpecificData

getPolymorphicDiscriminatorRecursively

getPolymorphicDiscriminatorSafely

  • getPolymorphicDiscriminatorSafely(serializer: Serializer, typeName?: undefined | string): any

getPolymorphicMapper

getPropertyFromParameterPath

getPropertyParent

getRegistrationStatus

  • Polls the registration status of the provider that was registered. Polling happens at an interval of 30 seconds. Polling will happen till the registrationState property of the response body is "Registered".

    Parameters

    • policy: RPRegistrationPolicy

      The RPRegistrationPolicy this function is being called against.

    • url: string

      The request url for polling

    • originalRequest: WebResourceLike

      The original request sent by the user that returned a 409 response with a message that the provider is not registered.

    Returns Promise<boolean>

    True if RP Registration is successful.

getRequestEssentials

getRuntimeInfo

getUserAgentString

  • getUserAgentString(telemetryInfo: TelemetryInfo[], keySeparator?: string, valueSeparator?: string): string

getValueOrFunctionResult

  • getValueOrFunctionResult(value: undefined | string | ((defaultValue: string) => string), defaultValueCreator: () => string): string

getXmlObjectValue

  • getXmlObjectValue(propertyMapper: Mapper, serializedValue: any, isXml: boolean, options: Required<SerializerOptions>): any

getXmlValueWithNamespace

  • getXmlValueWithNamespace(xmlNamespace: string | undefined, xmlnsKey: string, typeName: string, serializedValue: any, options: Required<SerializerOptions>): any

handleErrorResponse

handleRedirect

hasCurrentCharacter

isAlphaNumericCharacter

  • isAlphaNumericCharacter(character: string): boolean

isBypassed

  • isBypassed(uri: string): boolean | undefined

isDuration

  • isDuration(value: string): boolean

isElement

  • isElement(node: Node): node is Element

isHttpHeadersLike

  • isHttpHeadersLike(object?: unknown): object is HttpHeadersLike

isNumber

  • isNumber(n: unknown): n is number

isOperationSpecEmpty

isPrimitiveType

  • isPrimitiveType(value: unknown): boolean

isReadableStream

  • isReadableStream(body: any): body is Readable

isSpecialXmlProperty

  • isSpecialXmlProperty(propertyName: string, options: Required<SerializerOptions>): boolean

isStreamOperation

isUrlHttps

  • isUrlHttps(url: string): boolean

isValidPort

  • isValidPort(port: number): boolean

isValidUuid

  • isValidUuid(uuid: string): boolean

isWebResourceLike

  • isWebResourceLike(object: unknown): object is WebResourceLike

keepAlivePolicy

loadEnvironmentProxyValue

  • loadEnvironmentProxyValue(): string | undefined

loadNoProxy

  • loadNoProxy(): void

logPolicy

ndJsonPolicy

nextCharacter

  • nextCharacter(tokenizer: URLTokenizer, step?: undefined | number): void

nextHost

nextPath

nextPort

nextQuery

nextScheme

nextSchemeOrHost

operationOptionsToRequestOptionsBase

parse

parseHeaders

parseXML

peekCharacters

  • peekCharacters(tokenizer: URLTokenizer, charactersToPeek: number): string

prepareXMLRootList

  • prepareXMLRootList(obj: unknown, elementName: string, xmlNamespaceKey?: undefined | string, xmlNamespace?: undefined | string): {}

promiseToCallback

  • promiseToCallback(promise: Promise<any>): (cb: Function) => void
  • Converts a Promise to a callback.

    deprecated

    generated code should instead depend on responseToBody

    Parameters

    • promise: Promise<any>

      The Promise to be converted to a callback

    Returns (cb: Function) => void

    A function that takes the callback (cb: Function) => void

      • (cb: Function): void
      • Parameters

        • cb: Function

        Returns void

promiseToServiceCallback

proxyPolicy

readRemaining

readUntilCharacter

  • readUntilCharacter(tokenizer: URLTokenizer, ...terminatingCharacters: string[]): string

readWhile

  • readWhile(tokenizer: URLTokenizer, condition: (character: string) => boolean): string
  • Read characters from this Tokenizer until the end of the stream or until the provided condition is false when provided the current character.

    Parameters

    • tokenizer: URLTokenizer
    • condition: (character: string) => boolean
        • (character: string): boolean
        • Parameters

          • character: string

          Returns boolean

    Returns string

readWhileLetterOrDigit

redirectPolicy

registerIfNeeded

registerRP

rejectOnTerminalEvent

  • rejectOnTerminalEvent(request: WebResourceLike, xhr: XMLHttpRequest, reject: (err: any) => void): void

replaceAll

  • replaceAll(value: string | undefined, searchValue: string, replaceValue: string): string | undefined
  • Replace all of the instances of searchValue in value with the provided replaceValue.

    Parameters

    • value: string | undefined

      The value to search and replace in.

    • searchValue: string

      The value to search for in the value argument.

    • replaceValue: string

      The value to replace searchValue with in the value argument.

    Returns string | undefined

    The value where each instance of searchValue was replaced with replacedValue.

resolveAdditionalProperties

resolveModelProperties

resolveReferencedMapper

retry

rpRegistrationPolicy

serializeBase64UrlType

  • serializeBase64UrlType(objectName: string, value: Uint8Array): string

serializeBasicTypes

  • serializeBasicTypes(typeName: string, objectName: string, value: any): any

serializeByteArrayType

  • serializeByteArrayType(objectName: string, value: Uint8Array): string

serializeCompositeType

serializeDateTypes

  • serializeDateTypes(typeName: string, value: any, objectName: string): any

serializeDictionaryType

serializeEnumType

  • serializeEnumType(objectName: string, allowedValues: Array<any>, value: any): any

serializeObject

  • serializeObject(toSerialize: unknown): any

serializeRequestBody

serializeSequenceType

shouldDeserializeResponse

signingPolicy

splitSerializeName

  • splitSerializeName(prop: string | undefined): string[]

strEnum

  • strEnum<T>(o: Array<T>): {}

stringifyXML

stripRequest

stripResponse

systemErrorRetryPolicy

  • systemErrorRetryPolicy(retryCount?: undefined | number, retryInterval?: undefined | number, minRetryInterval?: undefined | number, maxRetryInterval?: undefined | number): RequestPolicyFactory

throttlingRetryPolicy

throwIfError

  • throwIfError(dom: Document): void

tracingPolicy

trimEnd

  • trimEnd(str: string, ch: string): string

unixTimeToDate

  • unixTimeToDate(n: number): Date | undefined

urlIsHTTPS

  • urlIsHTTPS(urlToCheck: { protocol: string }): boolean

userAgentPolicy

Object literals

Const Constants

Constants: object

ALL_PROXY

ALL_PROXY: string = "ALL_PROXY"

Specifies ALL Proxy.

HTTP

HTTP: string = "http:"

Specifies HTTP.

HTTPS

HTTPS: string = "https:"

Specifies HTTPS.

HTTPS_PROXY

HTTPS_PROXY: string = "HTTPS_PROXY"

Specifies HTTPS Proxy.

HTTP_PROXY

HTTP_PROXY: string = "HTTP_PROXY"

Specifies HTTP Proxy.

NO_PROXY

NO_PROXY: string = "NO_PROXY"

Specifies NO Proxy.

coreHttpVersion

coreHttpVersion: string = "1.2.1"

The core-http version

HeaderConstants

HeaderConstants: object

Defines constants for use with HTTP headers.

AUTHORIZATION

AUTHORIZATION: string = "authorization"

The Authorization header.

AUTHORIZATION_SCHEME

AUTHORIZATION_SCHEME: string = "Bearer"

RETRY_AFTER

RETRY_AFTER: string = "Retry-After"

The Retry-After response-header field can be used with a 503 (Service Unavailable) or 349 (Too Many Requests) responses to indicate how long the service is expected to be unavailable to the requesting client.

USER_AGENT

USER_AGENT: string = "User-Agent"

The UserAgent header.

HttpConstants

HttpConstants: object

HttpVerbs

HttpVerbs: object

Http Verbs

DELETE

DELETE: string = "DELETE"

GET

GET: string = "GET"

HEAD

HEAD: string = "HEAD"

MERGE

MERGE: string = "MERGE"

PATCH

PATCH: string = "PATCH"

POST

POST: string = "POST"

PUT

PUT: string = "PUT"

StatusCodes

StatusCodes: object

TooManyRequests

TooManyRequests: number = 429

Const DefaultDeserializationOptions

DefaultDeserializationOptions: object

expectedContentTypes

expectedContentTypes: object

json

json: Object = defaultJsonContentTypes

xml

xml: Object = defaultXmlContentTypes

Const DefaultKeepAliveOptions

DefaultKeepAliveOptions: object

enable

enable: true = true

Const DefaultRedirectOptions

DefaultRedirectOptions: object

handleRedirects

handleRedirects: true = true

maxRetries

maxRetries: number = 20

Const DefaultRetryOptions

DefaultRetryOptions: object

maxRetries

maxRetries: number = DEFAULT_CLIENT_RETRY_COUNT

maxRetryDelayInMs

maxRetryDelayInMs: number = DEFAULT_CLIENT_MAX_RETRY_INTERVAL

retryDelayInMs

retryDelayInMs: number = DEFAULT_CLIENT_RETRY_INTERVAL

Const xml2jsDefaultOptionsV2

xml2jsDefaultOptionsV2: object

async

async: boolean = false

attrNameProcessors

attrNameProcessors: undefined = undefined

attrValueProcessors

attrValueProcessors: undefined = undefined

attrkey

attrkey: string = XML_ATTRKEY

cdata

cdata: boolean = false

charsAsChildren

charsAsChildren: boolean = false

childkey

childkey: string = "$$"

chunkSize

chunkSize: number = 10000

doctype

doctype: undefined = undefined

emptyTag

emptyTag: string = ""

explicitArray

explicitArray: boolean = true

explicitCharkey

explicitCharkey: boolean = false

explicitChildren

explicitChildren: boolean = false

explicitRoot

explicitRoot: boolean = true

headless

headless: boolean = false

ignoreAttrs

ignoreAttrs: boolean = false

includeWhiteChars

includeWhiteChars: boolean = false

mergeAttrs

mergeAttrs: boolean = false

normalize

normalize: boolean = false

normalizeTags

normalizeTags: boolean = false

preserveChildrenOrder

preserveChildrenOrder: boolean = false

rootName

rootName: string = "root"

strict

strict: boolean = true

tagNameProcessors

tagNameProcessors: undefined = undefined

trim

trim: boolean = false

validator

validator: undefined = undefined

valueProcessors

valueProcessors: undefined = undefined

xmlns

xmlns: boolean = false

renderOpts

renderOpts: object

indent

indent: string = " "

newline

newline: string = ""

pretty

pretty: boolean = true

xmldec

xmldec: object

encoding

encoding: string = "UTF-8"

standalone

standalone: boolean = true

version

version: string = "1.0"

Generated using TypeDoc