mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +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
|
||||
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
|
||||
attacks via deeply nested payloads ([GHSA-62hf-57xw-28j9](https://github.com/axios/axios/security/advisories/GHSA-62hf-57xw-28j9)).
|
||||
Set to `Infinity` to disable the limit and restore pre-fix behaviour.
|
||||
attacks via deeply nested payloads. Set to `Infinity` to disable the limit and restore pre-fix behaviour.
|
||||
|
||||
```js
|
||||
// Raise the limit for a schema that genuinely nests deeper than 100 levels:
|
||||
axios.post('/api', data, { formSerializer: { maxDepth: 200 } });
|
||||
```js
|
||||
// Raise the limit for a schema that genuinely nests deeper than 100 levels:
|
||||
axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
|
||||
|
||||
// Same protection applies to params serialization:
|
||||
axios.get('/api', { params: data, paramsSerializer: { maxDepth: 200 } });
|
||||
```
|
||||
// Same protection applies to params serialization:
|
||||
axios.get('/api', { params: data, paramsSerializer: { maxDepth: 200 } });
|
||||
```
|
||||
|
||||
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
|
||||
// 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
|
||||
|
||||
@@ -87,7 +87,7 @@ Le sérialiseur FormData supporte des options supplémentaires via la propriét
|
||||
|
||||
```js
|
||||
// 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é
|
||||
|
||||
@@ -87,7 +87,7 @@ FormData serializer supports additional options via config.formSerializer: objec
|
||||
|
||||
```js
|
||||
// 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
|
||||
|
||||
@@ -87,7 +87,7 @@ FormData 序列化器通过 `config.formSerializer` 对象属性支持以下额
|
||||
|
||||
```js
|
||||
// 当 schema 确实需要超过 100 层嵌套时,可提高限制:
|
||||
axios.post('/api', data, { formSerializer: { maxDepth: 200 } });
|
||||
axios.postForm('/api', data, { formSerializer: { maxDepth: 200 } });
|
||||
```
|
||||
|
||||
::: warning 安全提示
|
||||
|
||||
Reference in New Issue
Block a user