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

response module: .notModified() and .redirect() break chainability #257

Closed
grob opened this issue Jun 14, 2014 · 3 comments
Closed

response module: .notModified() and .redirect() break chainability #257

grob opened this issue Jun 14, 2014 · 3 comments

Comments

@grob
Copy link
Member

grob commented Jun 14, 2014

.notModified() and .redirect() both return a plain JS object instead of this (a JsgiResponse instance), which breaks chainability and leads to errors with the current Stick CORS middleware (which requires the addHeaders() method of the response).

I couldn't figure out the reason for this, besides that normally no other response parameters are set in case of a 303 or 304, but for consistency reasons imho both methods should return the JsgiResponse instance.

@oberhamsi
Copy link
Member

looks like an oversight. I opened a PR:

https://github.com/ringo/ringojs/tree/response-always-return-this

/cc @botic

@grob grob closed this as completed in 589b01a Jun 24, 2014
@grob
Copy link
Member Author

grob commented Jun 24, 2014

i already had a commit locally that changed to always return this (since @botic also considered this an oversight), and accidentally committed it right now. sorry for that.

@botic
Copy link
Member

botic commented Jun 24, 2014

Yep, this looks like code from the previous JsgiRepsonse slipped into the new module since I don't considered use cases to chain redirects or not modified. Makes sense to keep the chain intact.

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