chore: api 在 patch 时支持 body (#3815)

* chore: api 在 patch 和 delete 时也支持 body

* delete 不传递 body

* 补充文档
This commit is contained in:
吴多益 2022-03-21 10:49:31 +08:00 committed by GitHub
parent d961b42753
commit 0a5a1861c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -136,7 +136,7 @@ API 还支持配置对象类型
### 配置请求方式 ### 配置请求方式
可以配置`method`指定接口的请求方式,支持:`get`、`post`、`put`、`delete`。 可以配置`method`指定接口的请求方式,支持:`get`、`post`、`put`、`delete`、`patch`
> `method`值留空时: > `method`值留空时:
> >

View File

@ -125,7 +125,11 @@ export function buildApi(
undefined, undefined,
api.convertKeyToPath api.convertKeyToPath
); );
} else if (api.method === 'post' || api.method === 'put') { } else if (
api.method === 'post' ||
api.method === 'put' ||
api.method === 'patch'
) {
api.body = api.data = cloneObject(data); api.body = api.data = cloneObject(data);
} }