This commit is contained in:
Pig Fang 2020-03-16 14:27:30 +08:00
parent a879af3405
commit 2907ad4bb4
2 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,5 @@
import Vue from 'vue'
import { emit } from './event'
import { queryStringify } from './utils'
import { showModal } from './notify'
import { trans, t } from './i18n'
@ -106,10 +105,10 @@ export function get<T = any>(url: string, params = empty): Promise<T> {
data: params,
})
const qs = queryStringify(params)
const qs = new URLSearchParams(params)
return walkFetch(
new Request(`${blessing.base_url}${url}${qs && `?${qs}`}`, init),
new Request(`${blessing.base_url}${url}?${qs}`, init),
)
}

View File

@ -28,7 +28,7 @@ test('the GET method', async () => {
expect(json).toBeCalled()
await net.get('/abc')
expect(window.fetch.mock.calls[1][0].url).toBe('/abc')
expect(window.fetch.mock.calls[1][0].url).toBe('/abc?')
})
test('the POST method', async () => {