divshot / ask

A simple, chainable way to construct HTTP requests in Node or the browser.
MIT License
4 stars 1 forks source link

Query string parameters #2

Closed scottcorgan closed 10 years ago

scottcorgan commented 10 years ago

@mbleigh @collin

I'd like to propose a simple way to build the query string parameters. This would be useful for pagination, etc.

var pager = request
  .origin('http://someapi.com')
  .get('test')
  .query('page', 1);

pager() // sends http request: http://someapi.com/test?page=1

pager.query('page', 2);

pager() // sends http request: http://someapi.com/test?page=2

What do you think?

collin commented 10 years ago

Sounds good

Sent from my iPhone

On Apr 17, 2014, at 10:26 AM, Scott Corgan notifications@github.com wrote:

@mbleigh @collin

I'd like to propose a simple way to build the query string parameters. This would be useful for pagination, etc.

var pager = request .origin('http://someapi.com') .get('test') .query('page', 1);

pager() // sends http request: http://someapi.com/test?page=1

pager.query('page', 2);

pager() // sends http request: http://someapi.com/test?page=2 What do you think?

— Reply to this email directly or view it on GitHub.