Skip to content

Commit 6984a58

Browse files
authored
Body appending to url (#178)
* v0.2.7 * fixed bug with body appending to url
1 parent 9983f1a commit 6984a58

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "use-http",
3-
"version": "0.2.6",
3+
"version": "0.2.7",
44
"homepage": "http://use-http.com",
55
"main": "dist/index.js",
66
"license": "MIT",

src/useFetch.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
UseFetchArgs,
1212
CachePolicies,
1313
} from './types'
14-
import { BodyOnly, FetchData, NoArgs } from './types'
14+
import { FetchData, NoArgs } from './types'
1515
import useFetchArgs from './useFetchArgs'
1616
import doFetchArgs from './doFetchArgs'
1717
import { isEmpty, invariant } from './utils'
@@ -177,13 +177,8 @@ function useFetch<TData = any>(...args: UseFetchArgs): UseFetch<TData> {
177177
if (dependencies && Array.isArray(dependencies)) {
178178
const methodName = requestInit.method || HTTPMethod.GET
179179
const methodLower = methodName.toLowerCase() as keyof ReqMethods
180-
if (methodName !== HTTPMethod.GET) {
181-
const req = request[methodLower] as BodyOnly
182-
req(requestInit.body as BodyInit)
183-
} else {
184-
const req = request[methodLower] as NoArgs
185-
req()
186-
}
180+
const req = request[methodLower] as NoArgs
181+
req()
187182
}
188183
}, dependencies)
189184

0 commit comments

Comments
 (0)