mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
docs: clarify behavior and relation to (#7460)
Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
@@ -497,6 +497,23 @@ These are the available config options for making requests. Only the `url` is re
|
|||||||
// `undefined` (default) - set XSRF header only for the same origin requests
|
// `undefined` (default) - set XSRF header only for the same origin requests
|
||||||
withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined),
|
withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined),
|
||||||
|
|
||||||
|
// `withXSRFToken` controls whether Axios reads the XSRF cookie and sets the XSRF header.
|
||||||
|
// - `undefined` (default): the XSRF header is set only for same-origin requests.
|
||||||
|
// - `true`: attempt to set the XSRF header for all requests (including cross-origin).
|
||||||
|
// - `false`: never set the XSRF header.
|
||||||
|
// - function: a callback that receives the request `config` and returns `true`,
|
||||||
|
// `false`, or `undefined` to decide per-request behavior.
|
||||||
|
//
|
||||||
|
// Note about `withCredentials`: `withCredentials` controls whether cross-site
|
||||||
|
// requests include credentials (cookies and HTTP auth). In older Axios versions,
|
||||||
|
// setting `withCredentials: true` implicitly caused Axios to set the XSRF header
|
||||||
|
// for cross-origin requests. Newer Axios separates these concerns: to allow the
|
||||||
|
// XSRF header to be sent for cross-origin requests you should set both
|
||||||
|
// `withCredentials: true` and `withXSRFToken: true`.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// axios.get('/user', { withCredentials: true, withXSRFToken: true });
|
||||||
|
|
||||||
// `onUploadProgress` allows handling of progress events for uploads
|
// `onUploadProgress` allows handling of progress events for uploads
|
||||||
// browser & node.js
|
// browser & node.js
|
||||||
onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) {
|
onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user