HttpApiClient

extensions/httpApi/client~ HttpApiClient

Http Api Client extension.

Constructor

new HttpApiClient()

Source:

Methods

clearBody()

Clears current request body
Source:

clearHeaders()

Clears current request headers.
Source:

clearRequestCookies()

Clears registered request cookies. Be aware that it does not clear existing response cookies.
Source:

disableCookies()

Disables cookie jar.
Source:

enableCookies()

Enables cookie jar.
Source:

getCookie(key) → {Object|null}

Retrieves a cookie by its key.
Source:
Parameters:
Name Type Description
key string Cookie key
Returns:
Type:
Object | null
The cookie object if any, or null

getCookies() → {Object}

Returns current response cookies.
Source:
Returns:
Type:
Object
current response cookies

getResponse()

Returns the latest collected response.
Source:

makeRequest(method, path, baseUrlopt)

Performs a request using all previously defined paramaters: - headers - query - body
Source:
Parameters:
Name Type Attributes Description
method string The http verb
path string The path
baseUrl string <optional>
The base url

reset()

Resets the client.
Source:

setCookie(cookie)

Sets a cookie. It does not actually add the cookie to the cookie jar because setting the cookie requires the request url, which we only have when making the request.
Source:
Parameters:
Name Type Description
cookie string | Object Cookie string or Object

setFormBody(payload)

Sets request form body.
Source:
Parameters:
Name Type Description
payload Object

setHeader(key, value)

Sets a single request header.
Source:
Parameters:
Name Type Description
key string
value string

setHeaders(headers)

Sets request headers.
Source:
Parameters:
Name Type Description
headers Object

setJsonBody(payload)

Sets request json body.
Source:
Parameters:
Name Type Description
payload Object

setQuery(query)

Sets request query parameters.
Source:
Parameters:
Name Type Description
query Object