hookehuyr

fix(请求参数): 修复URL查询参数解析问题

使用手动解析替代URLSearchParams以正确处理特殊字符
...@@ -73,10 +73,20 @@ const merge_request_params = (config) => { ...@@ -73,10 +73,20 @@ const merge_request_params = (config) => {
73 const base_url = parts[0] 73 const base_url = parts[0]
74 const search = parts.slice(1).join('?') 74 const search = parts.slice(1).join('?')
75 const url_params = {} 75 const url_params = {}
76 - const search_params = new URLSearchParams(search) 76 + if (search) {
77 - for (const [key, value] of search_params.entries()) { 77 + const pairs = search.split('&')
78 + for (let i = 0; i < pairs.length; i++) {
79 + const pair = pairs[i]
80 + if (!pair) continue
81 + const index = pair.indexOf('=')
82 + const raw_key = index >= 0 ? pair.slice(0, index) : pair
83 + const raw_value = index >= 0 ? pair.slice(index + 1) : ''
84 + const key = decodeURIComponent(raw_key || '')
85 + const value = decodeURIComponent(raw_value || '')
86 + if (!key) continue
78 url_params[key] = value 87 url_params[key] = value
79 } 88 }
89 + }
80 const merged_params = { 90 const merged_params = {
81 ...REQUEST_DEFAULT_PARAMS, 91 ...REQUEST_DEFAULT_PARAMS,
82 ...url_params, 92 ...url_params,
......