Functions - http

createHttpCachingClient

Creates an HTTP client capable of caching HTTP responses.

createHttpSecureClient

Creates an HTTP client capable of securing HTTP requests with authentication.

decode

Decodes the given URL.

encode

Encodes the given URL.

extractAuthorizationHeaderValue

Extracts the Authorization header value from the request.

invokeEndpoint

The HEAD remote function implementation of the Circuit Breaker. This wraps the head() function of the underlying HTTP remote function provider.

parseHeader

Parses the given header value to extract its value and parameter map.

createHttpCachingClient

(string url, ClientEndpointConfig config, CacheConfig cacheConfig)

returns HttpClient | error

Creates an HTTP client capable of caching HTTP responses.

Parameters

  • url string
  • The URL of the HTTP endpoint to connect to

  • config ClientEndpointConfig
  • The configurations for the client endpoint associated with the caching client

  • cacheConfig CacheConfig
  • The configurations for the HTTP cache to be used with the caching client

  • Return Type

    (HttpClient | error)
  • An HttpCachingClient instance which wraps the base Client with a caching layer

createHttpSecureClient

(string url, ClientEndpointConfig config)

returns HttpClient | error

Creates an HTTP client capable of securing HTTP requests with authentication.

Parameters

decode

(string url, string charset)

returns string | error

Decodes the given URL.

Parameters

  • url string
  • URL to be decoded

  • charset string
  • Character set from which the URL is decoded

  • Return Type

    (string | error)
  • The string Value of the decoded url or an error that occurred during decoding

encode

(string url, string charset)

returns string | error

Encodes the given URL.

Parameters

  • url string
  • URL to be encoded

  • charset string
  • Charactor set that URL to be encoded in

  • Return Type

    (string | error)
  • The string Value of the encoded url or an error that occurred during encoding

extractAuthorizationHeaderValue

(Request req)

returns string

Extracts the Authorization header value from the request.

Parameters

  • Return Type

    (string)
  • Value of the Authorization header

invokeEndpoint

(string path, Request outRequest, HttpOperation requestAction, HttpClient httpClient, string verb)

returns HttpResponse | error

The HEAD remote function implementation of the Circuit Breaker. This wraps the head() function of the underlying HTTP remote function provider.

Parameters

  • outRequest Request
  • A Request struct

  • requestAction HttpOperation
  • HttpOperation related to the request

  • httpClient HttpClient
  • HTTP client which uses to call the relevant functions

  • verb string
  • HTTP verb used for submit method

  • Return Type

    (HttpResponse | error)
  • The response for the request or an error if failed to establish communication with the upstream server

parseHeader

(string headerValue)

returns [string, map] | error

Parses the given header value to extract its value and parameter map.

Parameters

  • headerValue string
  • The header value

  • Return Type

    ([string, map] | error)
  • Returns a tuple containing the value and its parameter map