支持 api 配置成 get 携带 body, 但是 fetcher 那记得用 method-override, 否则浏览器不支持这么发送

Change-Id: I6d3b53fd61fee28b69faedcf48317684b2766ea7
This commit is contained in:
2betop 2020-11-04 15:38:03 +08:00
parent c46653fa7b
commit 1ee25adddf

View File

@ -96,6 +96,22 @@ export function buildApi(
if (api.method === 'get') {
if (!~raw.indexOf('$') && !api.data && autoAppend) {
api.data = data;
} else if (
api.attachDataToQuery === false &&
api.data &&
!~raw.indexOf('$') &&
autoAppend
) {
const idx = api.url.indexOf('?');
if (~idx) {
let params = {
...qs.parse(api.url.substring(idx + 1)),
...data
};
api.url = api.url.substring(0, idx) + '?' + qsstringify(params);
} else {
api.url += '?' + qsstringify(data);
}
}
if (api.data && api.attachDataToQuery !== false) {