koajs / cors

Cross-Origin Resource Sharing(CORS) for koa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

why set status of `options` for Preflight Request 204

NoraGithub opened this issue · comments

commented

I read the code and felt puzzle about setting the status 204 forever for the result of optionsrequest for Preflight Request. I thought it should be controlled by other components like a real backend( my one is django)

It would be greate if you can reply to give a hand. 👍

commented

Still unsolved

I may be wrong but it is to avoid sendind (or calculating) Content-length. Since OPTIONS has no content, 204 seems appropriate.

commented

Yes, you are right.
I search for some docs and sometimes it's said to be 200 and sometimes it's said to be 204, and 204 looks like the right answer according to the semantic. What I ought to doubt should be why my backend(DRF) return 200.
And one more issue, if some developers want to do something custom on the status code, it would fail. This situation is quite seldom , and I close it.

Thanks for your great job.