From b18ce9ee17298d91f071e88ba44f56d8a868dc7e Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Wed, 15 May 2024 09:48:04 +0800 Subject: [PATCH] fix: content-type set to text/plain in the digest POST request by overwriting it to application/json --- packages/web/lib/networking/networkHelpers.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/web/lib/networking/networkHelpers.ts b/packages/web/lib/networking/networkHelpers.ts index 0cf2d3bf9..d26733d6b 100644 --- a/packages/web/lib/networking/networkHelpers.ts +++ b/packages/web/lib/networking/networkHelpers.ts @@ -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 { method: 'POST', credentials: 'include', mode: 'cors', - headers: requestHeaders(), + headers: { + 'Content-Type': 'application/json', + ...requestHeaders(), + }, body: JSON.stringify(body), }) }