Skip to content

Commit 07b00dc

Browse files
author
z50902677
committed
修改
1 parent d831a8a commit 07b00dc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/fetch/fetch.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const fetchMethod = {
1010
function jsonToQueryString(jsonObj) {
1111
let queryStr = "";
1212
Object.keys(jsonObj).map((key)=> {
13-
const value = JSON.stringify(jsonObj[key]);
13+
const value = encodeURIComponent(JSON.stringify(jsonObj[key]));
1414
queryStr += `${key}=${value}&`;
1515
});
1616

@@ -26,6 +26,7 @@ function createFetch(url, method, jsonObj) {
2626
case fetchMethod.Get:
2727
{
2828
const queryStr = jsonToQueryString(jsonObj);
29+
console.log(`${url}?${queryStr}`);
2930
const urlWithQueryStr = `${url}?${queryStr}`;
3031
const options = {
3132
method: fetchMethod.Get

0 commit comments

Comments
 (0)