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

304 Not modified responds like a redirect #20

Closed
bnorton opened this issue Nov 18, 2016 · 2 comments
Closed

304 Not modified responds like a redirect #20

bnorton opened this issue Nov 18, 2016 · 2 comments
Labels

Comments

@bnorton
Copy link

bnorton commented Nov 18, 2016

I have a large response that changes infrequently that is a good use case for a status 304 to the browser. When I use that currently the json body that I have built is assigned to the Location response header.

In the handler I send back an ETag and test the If-None-Matchto see if a 304 is fitting.

An example of how simple the tests + fix can be https://github.com/chamaeleonidae/claudia-api-builder/commit/8d1222fefd67c6d7730a5707a42dd4d711630455

If this is useful I'll add a PR to support 304's

@gojko gojko added the bug label Nov 19, 2016
@gojko
Copy link
Member

gojko commented Nov 19, 2016

Hi,

304 is a bug, definitely, thanks for reporting it. A PR would be helpful. Your PR also removes CORS headers which I'm not 100% sure about (seems OK, just need to investigate some scenarios here first to confirm), so it would be good to split that into two PRs, so we can investigate/test both separately.

gojko added a commit that referenced this issue Nov 24, 2016
…Holly](https://github.com/phips28)) \

- limit magic location header only to actual 3xx redirects (301 and 302), allowing other codes such as 304 to be handled differently, fixes [issue 20](#20)
@gojko
Copy link
Member

gojko commented Nov 24, 2016

I think stripping the body is pushing a bit too much responsibility into the api builder, client developers should be able to decide that on their own - so when you send a 304, just don't send a body.

I've changed the api builder so it does not mess with the response unless it's 301/302, so 304 should be just like any other response now. the change is on NPM as version 2.1.0

@gojko gojko closed this as completed Nov 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants