fix: content-type set to text/plain in the digest POST request by overwriting it to application/json

This commit is contained in:
Hongbo Wu 2024-05-15 09:48:04 +08:00
parent 85b1dbd58a
commit b18ce9ee17

View file

@ -1,6 +1,6 @@
import { GraphQLClient } from 'graphql-request'
import { gqlEndpoint, fetchEndpoint } from '../appConfig'
import { IncomingMessage } from 'http'
import { fetchEndpoint, gqlEndpoint } from '../appConfig'
declare type RequestCookies = {
[key: string]: string
@ -74,7 +74,10 @@ export function apiPoster(path: string, body: any): Promise<Response> {
method: 'POST',
credentials: 'include',
mode: 'cors',
headers: requestHeaders(),
headers: {
'Content-Type': 'application/json',
...requestHeaders(),
},
body: JSON.stringify(body),
})
}