mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-20 22:51:23 +08:00
refactor: 请求的data不覆盖
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
// 实际请求参数如下, 部分内容省略, 敏感信息已进行混淆
|
||||
// 可按需修改此 API 的代码
|
||||
/* {"extInfo":"{\"lastRequestTimestamp\":1692358373509,\"lbsInfoList\":[{\"lat\":40.23076381,\"lon\":129.07545186,\"time\":1692358543},{\"lat\":40.23076381,\"lon\":129.07545186,\"time\":1692055283}],\"listenedTs\":false,\"noAidjToAidj\":true}","header":"{}","e_r":true} */
|
||||
/* {"extInfo":"{\"lastRequestTimestamp\":1692358373509,\"lbsInfoList\":[{\"lat\":40.23076381,\"lon\":129.07545186,\"time\":1692358543},{\"lat\":40.23076381,\"lon\":129.07545186,\"time\":1692055283}],\"listenedTs\":false,\"noAidjToAidj\":true}","header":"{}"} */
|
||||
|
||||
const createOption = require('../util/option.js')
|
||||
module.exports = (query, request) => {
|
||||
|
||||
+8
-2
@@ -2,8 +2,14 @@ const createOption = require('../util/option.js')
|
||||
module.exports = (query, request) => {
|
||||
const method = query.method || 'POST'
|
||||
const uri = query.uri
|
||||
const data =
|
||||
typeof query.data === 'string' ? JSON.parse(query.data) : query.data || {}
|
||||
let data = {}
|
||||
try {
|
||||
data =
|
||||
typeof query.data === 'string' ? JSON.parse(query.data) : query.data || {}
|
||||
} catch (e) {
|
||||
data = {}
|
||||
}
|
||||
|
||||
const crypto = query.crypto || ''
|
||||
|
||||
const res = request(method, uri, data, createOption(query, crypto))
|
||||
|
||||
Reference in New Issue
Block a user