Commit bd12fc9 1 parent 567bde9 commit bd12fc9 Copy full SHA for bd12fc9
File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change
1
+ const httpMethods = {
2
+ delete : "DELETE" ,
3
+ get : "GET" ,
4
+ patch : "PATCH" ,
5
+ put : "PUT" ,
6
+ post : "POST"
7
+ } as const ;
8
+
9
+ type HttpMethod = typeof httpMethods [ keyof typeof httpMethods ] ;
10
+
11
+ export { httpMethods } ;
12
+
13
+ export type { HttpMethod } ;
Original file line number Diff line number Diff line change 1
1
import fetch from "isomorphic-fetch" ;
2
2
3
3
import HttpResponseError from "./HttpResponseError" ;
4
+ import { HttpMethod } from "./httpMethod" ;
4
5
5
- type RequestJsonParams = Omit < RequestInit , "body" > & { data ?: unknown } ;
6
+ type RequestJsonParams = Omit < RequestInit , "body" | "method" > & {
7
+ data ?: unknown ;
8
+ method ?: HttpMethod ;
9
+ } ;
6
10
7
11
const responseToJson = ( response : Response ) => response . json ( ) ;
8
12
You can’t perform that action at this time.
0 commit comments