Skip to content

Commit ffe5878

Browse files
authored
Add more HTTP verbs (#311)
1 parent 328c839 commit ffe5878

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ var {
328328
patch,
329329
delete // don't destructure `delete` though, it's a keyword
330330
del, // <- that's why we have this (del). or use `request.delete`
331+
head,
332+
options,
333+
connect,
334+
trace,
331335
mutate, // GraphQL
332336
query, // GraphQL
333337
abort

docs/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ var {
309309
patch,
310310
delete // don't destructure `delete` though, it's a keyword
311311
del, // <- that's why we have this (del). or use `request.delete`
312+
head,
313+
options,
314+
connect,
315+
trace,
312316
mutate, // GraphQL
313317
query, // GraphQL
314318
abort

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export enum HTTPMethod {
99
PATCH = 'PATCH',
1010
POST = 'POST',
1111
PUT = 'PUT',
12+
CONNECT = 'CONNECT',
13+
TRACE = 'TRACE'
1214
}
1315

1416
// https://www.apollographql.com/docs/react/api/react/hoc/#optionsfetchpolicy

src/useFetch.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ function useFetch<TData = any>(...args: UseFetchArgs): UseFetch<TData> {
208208
post,
209209
patch: makeFetch(HTTPMethod.PATCH),
210210
put: makeFetch(HTTPMethod.PUT),
211+
options: makeFetch(HTTPMethod.OPTIONS),
212+
head: makeFetch(HTTPMethod.HEAD),
213+
connect: makeFetch(HTTPMethod.CONNECT),
214+
trace: makeFetch(HTTPMethod.TRACE),
211215
del,
212216
delete: del,
213217
abort: () => controller.current && controller.current.abort(),

0 commit comments

Comments
 (0)