Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ring-cors returns response with only normalized headers when handler returns nil and origin header is present #5

Open
melvinzhang opened this issue Oct 16, 2014 · 2 comments

Comments

@melvinzhang
Copy link

Compojure and other libraries that compose different handlers together expect to try handlers until the first one which returns a response map. Handlers indicate they do not handle a particular request by returning nil instead of a response map.

When wrapping a handler in ring-cors, (add-access-control request (handler request) access-control)) always returns a response map even when (handler request) is nil, this breaks the first non-nil handler logic of routing libraries.

@r0man
Copy link
Owner

r0man commented Oct 16, 2014

Patch and tests welcome ...

scottyw pushed a commit to scottyw/ring-cors that referenced this issue Oct 16, 2014
…handler returns nil per the existing tests. This wasn't occuring properly if allow-methods were specified and the request headers had an origin. Added a check for a nil response and corresponding test.
@scottyw
Copy link

scottyw commented Oct 20, 2014

Hi @r0man, just wondering if that fix I've proposed looks OK to you? Appreciate the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants