Axios Options

url: '/user'`url` is the server URL that will be used for the request
method: 'get'`method` is the request method to be used when making the request
baseURL: 'https://some-domain.com/api/'`baseURL` will be prepended to `URL` unless `URL` is absolute. It can be convenient to set `baseURL` for an instance of Axios to pass relative URLs to methods of that instance.
transformRequest`transformRequest` allows changes to the request data before it is sent to the server This is only applicable for request methods ‘PUT’, ‘POST’, ‘PATCH’ and ‘DELETE’ The last function in the array must return a string or an instance of Buffer, ArrayBuffer, FormData or Stream You may modify the headers object.
transformResponse`transformResponse` allows changes to the response data to be made before it is passed to then/catch
headers`headers` are custom headers to be sent
params`params` are the URL parameters to be sent with the request. Must be a plain object or a URLSearchParams object
paramsSerializer`paramsSerializer` is an optional function in charge of serializing `params`
data`data` is the data to be sent as the request body. Only applicable for request methods ‘PUT’, ‘POST’, and ‘PATCH’
timeout`timeout` specifies the number of milliseconds before the request times out. If the request takes longer than `timeout`, the request will be aborted.
withCredentials`withCredentials` indicates whether or not cross-site Access-Control requests should be made using credentials
adapter`adapter` allows custom handling of requests which makes testing easier.
auth`auth` indicates that HTTP Basic auth should be used, and supplies credentials.
responseType`responseType` indicates the type of data that the server will respond with options are: ‘arraybuffer’, ‘document’, ‘json’, ‘text’, ‘stream’ browser only: ‘blob’
responseEncoding`responseEncoding` indicates encoding to use for decoding responses
xsrfCookieName`xsrfCookieName` is the name of the cookie to use as a value for xsrf token
xsrfHeaderName`xsrfHeaderName` is the name of the http header that carries the xsrf token value
onUploadProgressonUploadProgress` allows handling of progress events for uploads
onDownloadProgress`onDownloadProgress` allows handling of progress events for downloads
maxContentLength`maxContentLength` defines the max size of the http response content in bytes allowed
maxBodyLength`maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed
validateStatus`validateStatus` defines whether to resolve or reject the promise for a given
maxRedirects`maxRedirects` defines the maximum number of redirects to follow in node.js. If set to 0, no redirects will be followed.
socketPath`socketPath` defines a UNIX Socket to be used in node.js.
httpAgent
and
httpsAgent
httpAgent` and `httpsAgent` define a custom agent to be used when performing http and https requests, respectively, in node.js. This allows options to be added like `keepAlive` that are not enabled by default.
proxy`proxy` defines the hostname and port of the proxy server.
cancelToken`cancelToken` specifies a cancel token that can be used to cancel the request
decompress`decompress` indicates whether or not the response body should be decompressed automatically. If set to `true` will also remove the ‘content-encoding’ header from the responses objects of all decompressed responses

Leave a Reply

Your email address will not be published. Required fields are marked *