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

Add query() method to server::Request #897

Closed
seanmonstar opened this issue Aug 22, 2016 · 2 comments
Closed

Add query() method to server::Request #897

seanmonstar opened this issue Aug 22, 2016 · 2 comments
Labels
A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Milestone

Comments

@seanmonstar
Copy link
Member

Similar to #896

fn query(&self) -> Option<&str>;
@seanmonstar seanmonstar added A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor. labels Aug 22, 2016
@seanmonstar seanmonstar added this to the 0.10 milestone Aug 22, 2016
@hagsteel
Copy link

hagsteel commented Aug 24, 2016

What about using a hashmap for the query string?
I imagine that any time you want to work with the querystring you want to work with the values.

e.g pagination

let page = request.query["page"].unwrap();

@seanmonstar
Copy link
Member Author

You might want the query params, but not necessarily. A somewhat common usecase for a query string is as a cache buster, i.e. /foo/bar.js?abcdef, such as adding a timestamp or sha to the end. I'd also prefer leaving the choice of what to parse them into up to the user. Whether that is Vec<(Name, Value)>, a HashMap, or whatever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

No branches or pull requests

2 participants