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: object) => Promise<string>

Type declaration

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

      • challenge: object

      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

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.

    const
  • 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.

    const
  • USER_AGENT: string

    The UserAgent header.

    const

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

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")

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 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(targetCtor: any, sourceCtors: any[]): void
  • Applies the properties on the prototype of sourceCtors to the prototype of targetCtor

    Parameters

    • targetCtor: any

      The target object on which the properties need to be applied.

    • 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): 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>
  • 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>

    Resolved promise

deserializationPolicy

deserializeCompositeType

deserializeDictionaryType

deserializeResponseBody

deserializeSequenceType

disableResponseDecompressionPolicy

domToObject

  • domToObject(node: Node): any

encodeByteArray

  • encodeByteArray(value: Uint8Array): string

encodeString

  • encodeString(value: string): string

encodeUri

  • encodeUri(uri: string): string

executePromisesSequentially

  • executePromisesSequentially(promiseFactories: Array<any>, kickstart: any): 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

getCurrentCharacter

getDefaultProxySettings

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

getDefaultUserAgentKey

  • getDefaultUserAgentKey(): string

getDefaultUserAgentValue

  • getDefaultUserAgentValue(): string

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

handleRedirect

hasCurrentCharacter

isAlphaNumericCharacter

  • isAlphaNumericCharacter(character: string): boolean

isDuration

  • isDuration(value: string): boolean

isElement

  • isElement(node: Node): node is Element

isHttpHeadersLike

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

isNumber

  • isNumber(n: any): n is number

isPrimitiveType

  • isPrimitiveType(value: any): boolean

isReadableStream

  • isReadableStream(body: any): body is Readable

isSpecialXmlProperty

  • isSpecialXmlProperty(propertyName: string): boolean

isStreamOperation

isUrlHttps

  • isUrlHttps(url: string): boolean

isValidPort

  • isValidPort(port: number): boolean

isValidUuid

  • isValidUuid(uuid: string): boolean

isWebResourceLike

  • isWebResourceLike(object: any): object is WebResourceLike

keepAlivePolicy

loadEnvironmentProxyValue

  • loadEnvironmentProxyValue(): string | undefined

logPolicy

nextCharacter

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

nextHost

nextPath

nextPort

nextQuery

nextScheme

nextSchemeOrHost

operationOptionsToRequestOptionsBase

parse

parseHeaders

parseXML

  • parseXML(str: string, opts?: undefined | { includeRoot?: undefined | false | true }): Promise<any>
  • Converts given XML string into JSON

    Parameters

    • str: string

      String containing the XML content to be parsed into JSON

    • Optional opts: undefined | { includeRoot?: undefined | false | true }

      Options that govern the parsing of given xml string includeRoot indicates whether the root element is to be included or not in the output

    Returns Promise<any>

peekCharacters

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

prepareXMLRootList

  • prepareXMLRootList(obj: any, elementName: string): {}

promiseToCallback

  • promiseToCallback(promise: Promise<any>): Function
  • 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 Function

    A function that takes the callback (cb: Function): 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.

resolveModelProperties

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: any): any

serializeRequestBody

serializeSequenceType

shouldDeserializeResponse

shouldRetry

signingPolicy

splitSerializeName

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

strEnum

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

stringifyXML

  • stringifyXML(obj: any, opts?: undefined | { rootName?: undefined | string }): string
  • Converts given JSON object to XML string

    Parameters

    • obj: any

      JSON object to be converted into XML string

    • Optional opts: undefined | { rootName?: undefined | string }

      Options that govern the parsing of given JSON object rootName indicates the name of the root element in the resulting XML

    Returns string

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

updateRetryData

  • updateRetryData(retryOptions: { maxRetryInterval: number; minRetryInterval: number; retryInterval: number }, retryData?: RetryData, err?: RetryError): RetryData

urlIsHTTPS

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

userAgentPolicy

Object literals

Const Constants

Constants: object

HTTP

HTTP: string = "http:"

Specifies HTTP.

const

HTTPS

HTTPS: string = "https:"

Specifies HTTPS.

const

HTTPS_PROXY

HTTPS_PROXY: string = "HTTPS_PROXY"

Specifies HTTPS Proxy.

const

HTTP_PROXY

HTTP_PROXY: string = "HTTP_PROXY"

Specifies HTTP Proxy.

const

coreHttpVersion

coreHttpVersion: string = "1.1.8"

The core-http version

const

HeaderConstants

HeaderConstants: object

Defines constants for use with HTTP headers.

AUTHORIZATION

AUTHORIZATION: string = "authorization"

The Authorization header.

const

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.

const

USER_AGENT

USER_AGENT: string = "User-Agent"

The UserAgent header.

const

HttpConstants

HttpConstants: object

HttpVerbs

HttpVerbs: object

Http Verbs

const

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: null = null

attrValueProcessors

attrValueProcessors: null = null

attrkey

attrkey: string = "$"

cdata

cdata: boolean = false

charkey

charkey: string = "_"

charsAsChildren

charsAsChildren: boolean = false

childkey

childkey: string = "$$"

chunkSize

chunkSize: number = 10000

doctype

doctype: null = null

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: null = null

trim

trim: boolean = false

validator

validator: null = null

valueProcessors

valueProcessors: null = null

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