|
|
@@ -41,9 +41,15 @@ const axiosFetch = async (url: RequestInfo | URL, init?: RequestInit) => {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ // 处理204 No Content响应,不设置body
|
|
|
+ const body = response.status === 204
|
|
|
+ ? null
|
|
|
+ : responseHeaders.get('content-type')?.includes('application/json')
|
|
|
+ ? JSON.stringify(response.data)
|
|
|
+ : response.data;
|
|
|
+
|
|
|
return new Response(
|
|
|
- responseHeaders.get('content-type')?.includes('application/json') ?
|
|
|
- JSON.stringify(response.data) : response.data,
|
|
|
+ body,
|
|
|
{
|
|
|
status: response.status,
|
|
|
statusText: response.statusText,
|