From 165bfa203c87400d222bec0fb66759c2530d99f9 Mon Sep 17 00:00:00 2001 From: Junseo Park Date: Sat, 27 Feb 2021 18:35:26 +0900 Subject: [PATCH] feat: json content-type default for Fetch --- utils/Fetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/Fetch.ts b/utils/Fetch.ts index b4b7b55..db88b47 100644 --- a/utils/Fetch.ts +++ b/utils/Fetch.ts @@ -4,7 +4,7 @@ import { KoreanbotsEndPoints } from './Constants' const Fetch = async (endpoint: string, options?: RequestInit):Promise> => { const url = KoreanbotsEndPoints.baseAPI + ( endpoint.startsWith('/') ? endpoint : '/' + endpoint) - const res = await fetch(url, options ?? { method: 'GET' }) + const res = await fetch(url, { method: 'GET', headers: { 'content-type': 'application/json', ...options.headers }, ...options }) let json = {}