We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 567bde9 commit bd12fc9Copy full SHA for bd12fc9
src/httpMethod.ts
@@ -0,0 +1,13 @@
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};
src/httpRequest.ts
@@ -1,8 +1,12 @@
import fetch from "isomorphic-fetch";
import HttpResponseError from "./HttpResponseError";
+import {HttpMethod} from "./httpMethod";
-type RequestJsonParams = Omit<RequestInit, "body"> & {data?: unknown};
+type RequestJsonParams = Omit<RequestInit, "body" | "method"> & {
+ data?: unknown;
+ method?: HttpMethod;
+};
const responseToJson = (response: Response) => response.json();
0 commit comments