mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40:40 +03:00
fix: docs (#10727)
This commit is contained in:
@@ -1336,16 +1336,15 @@ FormData serializer supports additional options via `config.formSerializer: obje
|
|||||||
- `maxDepth: number = 100` - maximum object nesting depth the serializer will recurse into. If the
|
- `maxDepth: number = 100` - maximum object nesting depth the serializer will recurse into. If the
|
||||||
input object exceeds this depth, an `AxiosError` with `code: 'ERR_FORM_DATA_DEPTH_EXCEEDED'` is
|
input object exceeds this depth, an `AxiosError` with `code: 'ERR_FORM_DATA_DEPTH_EXCEEDED'` is
|
||||||
thrown instead of overflowing the call stack. This protects server-side applications from DoS
|
thrown instead of overflowing the call stack. This protects server-side applications from DoS
|
||||||
attacks via deeply nested payloads ([GHSA-62hf-57xw-28j9](https://github.com/axios/axios/security/advisories/GHSA-62hf-57xw-28j9)).
|
attacks via deeply nested payloads. Set to `Infinity` to disable the limit and restore pre-fix behaviour.
|
||||||
Set to `Infinity` to disable the limit and restore pre-fix behaviour.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Raise the limit for a schema that genuinely nests deeper than 100 levels:
|
// Raise the limit for a schema that genuinely nests deeper than 100 levels:
|
||||||
axios.post('/api', data, { formSerializer: { maxDepth: 200 } });
|
axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
|
||||||
|
|
||||||
// Same protection applies to params serialization:
|
// Same protection applies to params serialization:
|
||||||
axios.get('/api', { params: data, paramsSerializer: { maxDepth: 200 } });
|
axios.get('/api', { params: data, paramsSerializer: { maxDepth: 200 } });
|
||||||
```
|
```
|
||||||
|
|
||||||
Let's say we have an object like this one:
|
Let's say we have an object like this one:
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ El serializador de FormData admite opciones adicionales a través de la propieda
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
// Aumentar el límite para esquemas que legítimamente exceden 100 niveles:
|
// Aumentar el límite para esquemas que legítimamente exceden 100 niveles:
|
||||||
axios.post('/api', data, { formSerializer: { maxDepth: 200 } });
|
axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
|
||||||
```
|
```
|
||||||
|
|
||||||
::: warning Nota de seguridad
|
::: warning Nota de seguridad
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ Le sérialiseur FormData supporte des options supplémentaires via la propriét
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
// Autoriser une imbrication plus profonde pour les schémas qui dépassent légitimement 100 niveaux :
|
// Autoriser une imbrication plus profonde pour les schémas qui dépassent légitimement 100 niveaux :
|
||||||
axios.post('/api', data, { formSerializer: { maxDepth: 200 } });
|
axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
|
||||||
```
|
```
|
||||||
|
|
||||||
::: warning Note de sécurité
|
::: warning Note de sécurité
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ FormData serializer supports additional options via config.formSerializer: objec
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
// Allow deeper nesting for schemas that legitimately exceed 100 levels:
|
// Allow deeper nesting for schemas that legitimately exceed 100 levels:
|
||||||
axios.post('/api', data, { formSerializer: { maxDepth: 200 } });
|
axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
|
||||||
```
|
```
|
||||||
|
|
||||||
::: warning Security note
|
::: warning Security note
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ FormData 序列化器通过 `config.formSerializer` 对象属性支持以下额
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
// 当 schema 确实需要超过 100 层嵌套时,可提高限制:
|
// 当 schema 确实需要超过 100 层嵌套时,可提高限制:
|
||||||
axios.post('/api', data, { formSerializer: { maxDepth: 200 } });
|
axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
|
||||||
```
|
```
|
||||||
|
|
||||||
::: warning 安全提示
|
::: warning 安全提示
|
||||||
|
|||||||
Reference in New Issue
Block a user