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

支持 CORS 预检 #577

Closed
wants to merge 402 commits into from
Closed

支持 CORS 预检 #577

wants to merge 402 commits into from

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})
})

@nondanee
Copy link
Contributor Author

@Binaryify
悄悄问一下 master 是不是 rebase 过?
我 merge 你的 master 直接懵逼了,全是 conflict,多了 300+ commit 😂
也可能是我姿势不对 =.=

你 merge 的时候选一下 squash 吧
或者 close 了你自己 commit 也行~

@Binaryify
Copy link
Owner

@nondanee 哈哈,之前 git config 那里邮箱我没配好,很多提交都没记录上,本来一直没管的,朋友说影响挺大的,10天前就把提交记录里邮箱的都改写了,然后 push --force 了

@Binaryify
Copy link
Owner

现在最好就是删掉 fork 的仓库,重新 fork

@nondanee
Copy link
Contributor Author

@Binaryify 好的

@nondanee nondanee closed this 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