From 4f62f6f288d624e8089b957c88d45b3f68283b0c Mon Sep 17 00:00:00 2001 From: 果物リン Date: Tue, 17 Jan 2023 06:47:46 +0900 Subject: application/json の content-type header をデフォルトで付与する (#52) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/api.ts b/src/api.ts index 2cf8488106..1704b6e462 100644 --- a/src/api.ts +++ b/src/api.ts @@ -19,6 +19,7 @@ export type FetchLike = (input: string, init?: { body?: string; credentials?: RequestCredentials; cache?: RequestCache; + headers: {[key in string]: string} }) => Promise<{ status: number; json(): Promise; @@ -75,6 +76,9 @@ export class APIClient { ...params, i: credential !== undefined ? credential : this.credential, }), + headers: { + 'Content-Type': 'application/json', + }, credentials: 'omit', cache: 'no-cache', }).then(async (res) => { -- cgit v1.2.3-freya