Skip to content

utils.js

James ZHANG edited this page Jan 16, 2022 · 2 revisions

Functions

isProcessEnv()boolean

Similar to isStandardBrowserEnv, just check it's running in a Node environment

isProcessFormData(val)boolean

Determine if a value is a form-data node module

userAgent()string

Compose the User-Agent content

implicityReturnValues(message, response)AssertionError

Customize an AssertionError with the original data, minimum implementated the AxiosResponse stucture.

Note here: It's not a good idea that thrown the AssertionError from axios.transformData forEach stack. The fulfilled AxiosResponse is { status, statusText, headers, config, request }, here can only touched the data and headers, postpone onto next major version to re-design.

isProcessEnv() ⇒ boolean

Similar to isStandardBrowserEnv, just check it's running in a Node environment

Kind: global function
Returns: boolean - Ture on Node, otherwise false

isProcessFormData(val) ⇒ boolean

Determine if a value is a form-data node module

Kind: global function
Returns: boolean - True if value is a form-data module, otherwise false
See

Param Type Description
val Object To test value

userAgent() ⇒ string

Compose the User-Agent content

Kind: global function
Returns: string - - The User-Agent value

implicityReturnValues(message, response) ⇒ AssertionError

Customize an AssertionError with the original data, minimum implementated the AxiosResponse stucture.

Note here: It's not a good idea that thrown the AssertionError from axios.transformData forEach stack. The fulfilled AxiosResponse is { status, statusText, headers, config, request }, here can only touched the data and headers, postpone onto next major version to re-design.

Kind: global function
Returns: AssertionError - - The customized AssertionError

Param Type Description
message string The message
response string | object | any the response
...params Array.<string> | Array.<int> the params