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

Plugin to make res.status() chainable. #1851

Open
3 tasks done
june07 opened this issue Jul 22, 2020 · 2 comments
Open
3 tasks done

Plugin to make res.status() chainable. #1851

june07 opened this issue Jul 22, 2020 · 2 comments

Comments

@june07
Copy link

june07 commented Jul 22, 2020

  • Used appropriate template for the issue type
  • Searched both open and closed issues for duplicates of this issue
  • Title adequately and concisely reflects the feature or the bug

Feature Request

Use Case

Working on a multi service system where Express.js is used for some services and Restify for others. The middleware is written such that it expects res.status to be chainable, so when passing in Restify objects, the middleware errors:

TypeError: res.status(...).send is not a function

I've written a plugin which provides this:
june07@0ec0d88

Following the proper flow to see if I can open a PR for this.

@ghermeto
Copy link
Member

I don't oppose this change because we already return this on many of the Response methods, so it would be consistent. However, this is definitely a breaking change and it would have to go out on 9.x.

For now, I believe the following would work for both Express and Restify:

res.status(...);
res.send(...);

@restify/current-core any other thoughts?

@june07
Copy link
Author

june07 commented Aug 11, 2020

@ghermeto Thank you. It's been almost 3 weeks without any further input from @restify/current-core so I've submitted a PR. Also you are absolutely right with the suggestion below, if changing the code was feasible. Otherwise when the code is upstream, or owned by someone else, this PR should help.

res.status(...);
res.send(...);

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

2 participants