-
Notifications
You must be signed in to change notification settings - Fork 15
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
I should depend on raw-body #2
Comments
probably depend - raw-body doesn't actually parse the string. i was thinking about making a i'm not sure what's the point of using the string decoder vs. buffer.toString() though. only issue i can think about that is getting the correct charset from the request body if it isn't utf8. also, not including string parser is easier for me since then i can implement the string parser however i want. see: https://github.com/koajs/body-parser/blob/master/index.js |
@jonathanong So I don't know whether string decoder of Buffer.concat(buffers) is better. should have a bench mark. I copied @izs code from npm-www which uses |
@jonathanong btw I'm going through express & connect and rewriting them using small modules. If you have any modules to recommend using you should add them to the wiki page ! |
yeah, i don't know which one is faster, but i prefer fewer lines of code. i doubt any performance differences are significant, though. |
sick! i actually wanted to do that, but unfortunately a lot of the middleware rely on connect patches like most of the remaining connect issues are sessions, but sessions right now are such a mess that i don't want to touch them. for koa, tj's been thinking about just making tests for a session "spec" which implementors can use instead of relying on |
@jonathanong look at generic-session & redsess & level-session. that's what I use, I like them. but of course it doesn't have that crazy asynchronously load session for each req before route and asynchronously save session for each res.end() |
Buffer.concat is not better unless for some reason you already HAVE a list of buffers. If you're collecting a stream into a string, then StringDecoder is better in both time and space. |
@isaacs I broke out your npm-www things, should I PR them back into npm-www ? |
is the impact significant? also, why even bother using string decoder then? why not just do |
@jonathanong If you pipe the |
oh, that's true. there was a bug where someone decided to set the encoding for no reason. |
actually, that wouldn't matter. you assume the data is in buffers as well. either way, i'll add encoding support to raw-body. |
@jonathanong I did a code review of raw-body and added some issues! Once those are handled I'll update this to depend on raw-body instead. |
I updated the code to depend on Waiting for @jonathanong to publish a version of raw-body. Added @jonathanong as a collaborator aswell. You can make alterations. If your not sure about stuff make PRs and I'll review it. |
Now depends on raw-body form npm. Published as v4.0.2 |
@jonathanong authored raw-body which has very similar concerns
Either I should depend on it or maybe this module should just be merged with it.
The text was updated successfully, but these errors were encountered: