Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

支持 CORS 预检 #578

Merged
merged 1 commit into from
Aug 25, 2019
Merged

支持 CORS 预检 #578

merged 1 commit into from
Aug 25, 2019

Conversation

nondanee
Copy link
Contributor

fix #564
因预检 (OPTIONS) 请求没有 body
不带参请求网易云服务器返回 400 参数错误
以及内部在 undefined 上 split,hash 请出错返回 500
无法通过预检而无法跨域

解决方法:在中间件直接返回预检成功,不 next() 到路由处理请求
测试用例

fetch('http://localhost:3000/song/url', {
	method: 'POST',
	mode: 'cors',
	credentials: 'include',
	headers: {'content-type': 'application/json'},
	body: JSON.stringify({id: 347230})
})

@Binaryify Binaryify merged commit f848a00 into Binaryify:master Aug 25, 2019
Binaryify added a commit that referenced this pull request Aug 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

post
2 participants