mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-03 15:12:10 +08:00
update: request增加headers选项
This commit is contained in:
parent
312434bc99
commit
846b7e5fbc
@ -46,6 +46,11 @@ const chooseUserAgent = (ua = false) => {
|
||||
const createRequest = (method, url, data = {}, options) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let headers = { 'User-Agent': chooseUserAgent(options.ua) }
|
||||
options.headers = options.headers || {}
|
||||
headers = {
|
||||
...headers,
|
||||
...options.headers,
|
||||
}
|
||||
if (method.toUpperCase() === 'POST')
|
||||
headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
||||
if (url.includes('music.163.com'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user