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
A few ideas: options.extendTypes.custom, options.handler, split buffer thingy? #52
Comments
@codeinvain, @ztrange, @LaurensRietveld, @internalfx, @creeperyang and @daiwhea, thoughts? |
It sounds cool! On an unrelated matter, since you stopped using this.body, I think the major version (semver) should be bumped, since it is a breaking change. |
@ztrange I agree. @tunnckoCore I think these are great additions. However, they are very likely to break existing apps. |
@ztrange, i'm not sure enough. in one side, it is bugfix to wrong behaviour - it was total mistake, in another yea it is breaking change, but dont thinking for major bump, but for minor definitely. about the ideas, i'll try to push them today. |
but yea maybe you are right, i'll add these features and bump major directly |
All is implemented as suggested. |
Get an ideas.
split buffer thingy
Currently (in v2.0):
options.buffer: true
and trick the things throughoptions.extendTypes.text
(because that's the only way to use thethis.request.buffer
parser to parse buffers). you will receive it inthis.request.body
options.textLimit
oroptions.bufferLimit
I'm asking myself, isn't it will be better if there's separate
if
foroptions.extendTypes.buffer
and try to parse it separate from text? So i came to the next idea forextendTypes.custom
options.extendTypes.custom and options.handler
So, to be able hack the things legally. Meaning if you wanna parse
foo/bar-x
type, for instance, you will pass that type tooptions.extendTypes.custom: ['foo/bar-x']
, thenoptions.handler.call(ctx, ctx, options, next)
will be called.related: #22 and #31
This will give you the freedom and ability to do whatever you want:
this
context (ctx
)options
)ctx.request.json
,ctx.request.urlencoded
,ctx.request.multipart
,ctx.request.text
andctx.request.buffer
The text was updated successfully, but these errors were encountered: