feat: json content-type default for Fetch

This commit is contained in:
Junseo Park 2021-02-27 18:35:26 +09:00
parent 94660f32f8
commit 165bfa203c

View File

@ -4,7 +4,7 @@ import { KoreanbotsEndPoints } from './Constants'
const Fetch = async <T>(endpoint: string, options?: RequestInit):Promise<ResponseProps<T>> => { const Fetch = async <T>(endpoint: string, options?: RequestInit):Promise<ResponseProps<T>> => {
const url = KoreanbotsEndPoints.baseAPI + ( endpoint.startsWith('/') ? endpoint : '/' + endpoint) 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 = {} let json = {}