mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
修复代码错误
This commit is contained in:
parent
4f7266e4a5
commit
3b15fe9024
17
app.js
17
app.js
@ -38,15 +38,14 @@ app.use((req, res, next) => {
|
|||||||
|
|
||||||
// cookie parser
|
// cookie parser
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
req.cookies = {}(req.headers.cookie || '')
|
req.cookies = {}
|
||||||
.split(/\s*;\s*/)
|
;(req.headers.cookie || '').split(/\s*;\s*/).forEach((pair) => {
|
||||||
.forEach((pair) => {
|
let crack = pair.indexOf('=')
|
||||||
let crack = pair.indexOf('=')
|
if (crack < 1 || crack == pair.length - 1) return
|
||||||
if (crack < 1 || crack == pair.length - 1) return
|
req.cookies[
|
||||||
req.cookies[
|
decodeURIComponent(pair.slice(0, crack)).trim()
|
||||||
decodeURIComponent(pair.slice(0, crack)).trim()
|
] = decodeURIComponent(pair.slice(crack + 1)).trim()
|
||||||
] = decodeURIComponent(pair.slice(crack + 1)).trim()
|
})
|
||||||
})
|
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user