application/json の content-type header をデフォルトで付与する (#52)

This commit is contained in:
果物リン 2023-01-17 06:47:46 +09:00 committed by GitHub
parent fc921d8c1d
commit 4f62f6f288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,7 @@ export type FetchLike = (input: string, init?: {
body?: string; body?: string;
credentials?: RequestCredentials; credentials?: RequestCredentials;
cache?: RequestCache; cache?: RequestCache;
headers: {[key in string]: string}
}) => Promise<{ }) => Promise<{
status: number; status: number;
json(): Promise<any>; json(): Promise<any>;
@ -75,6 +76,9 @@ export class APIClient {
...params, ...params,
i: credential !== undefined ? credential : this.credential, i: credential !== undefined ? credential : this.credential,
}), }),
headers: {
'Content-Type': 'application/json',
},
credentials: 'omit', credentials: 'omit',
cache: 'no-cache', cache: 'no-cache',
}).then(async (res) => { }).then(async (res) => {