mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 06:20:24 +00:00
feat: json content-type default for Fetch
This commit is contained in:
parent
94660f32f8
commit
165bfa203c
@ -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 = {}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user