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

Question: net/http.Request.Form equivalent? #55

Closed
mxmCherry opened this issue Feb 20, 2016 · 3 comments
Closed

Question: net/http.Request.Form equivalent? #55

mxmCherry opened this issue Feb 20, 2016 · 3 comments
Labels

Comments

@mxmCherry
Copy link

Hi,

I have a question, if there's any analog to http.Request.Form container planned?
http.Request doc

Or any convenience methods like PeekMulti(name) (for fasthttp.RequestCtx and/or fasthttp.Request), that peek multi params both from query and body?

I guess, this may lead to increased memory usage (for http.Request.Form analog) or memory allocations (for PeekMulti(name) methods) or be tricky to implement (pooling, if possible).

Or some kind of walker method like .Visit(name, callback(value)) (also for fasthttp.RequestCtx and/or fasthttp.Request) would be also nice (and shouldn't result in memory allocs). Btw, I've read code for peekArgStr and it seems, that such .Visit method (that focuses on specific param name) would not provide any performance gain, as peekArgStr already loops through key-value pair list (and I don't think, that this should/can be optimized).

Anyway, that's just a question/suggestion; that's, obviously, not hard to work around.

@valyala
Copy link
Owner

valyala commented Feb 22, 2016

Fasthttp already provides such methods:

Both QueryArgs and PostArgs return Args, which has PeekMulti convenience method for obtaining multiple values for the same key. Args also has VisitAll method for visiting all the (key, value) pairs from Args.

@valyala
Copy link
Owner

valyala commented Feb 22, 2016

Closing the question. @mxmCherry , feel free re-opening it if there are unanswered questions I didn't notice here.

@valyala valyala closed this as completed Feb 22, 2016
@mxmCherry
Copy link
Author

Not what I meant, but thanks for replying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants