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

don't touch original req/res #64

Closed
jonathanong opened this issue Oct 25, 2013 · 3 comments
Closed

don't touch original req/res #64

jonathanong opened this issue Oct 25, 2013 · 3 comments

Comments

@jonathanong
Copy link
Member

would be nice if koa didn't touch the original req/res. since we're building a wrapper around them, i don't see why it would be necessary.

example is:

  /**
   * Set request URL.
   *
   * @api public
   */

  set url(val) {
    this.req.url = val;
  },

Wish it were something else like:

  get url() {
    return this._url || this.req.url
  },

  set url(val) {
    this._url = val
  }
@tj
Copy link
Member

tj commented Oct 25, 2013

that would be nice in some ways, I've found in practice usually the only thing you really want "raw" access to that has not been modified is the original request url, I've never seen anyone manipulate request headers or anything like that, definitely would be bad practice at least. For now I don't think it's worth it but maybe in the future

@jonathanong
Copy link
Member Author

yeah, this is the only case i can think of. if we don't edit req.url, we won't have to do any .originalUrl stuff, though you'll have to pass the mount points to sub apps somehow.

@jonathanong
Copy link
Member Author

merging into #49

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