osmlab/ohauth — pull request #2 by szywon (2013-04-22 12:03:53+00:00)
Title: headerGenerator function.

Introduced headerGenerator function that simplifies header generation (when you don't want to use ohauth to do requests). OAuth configuration is passed once and what you get is a function that takes only data, takes care of all the procedures and returns a header ready to be put in a request. Example:

```js
// create a function holding configuration
var auth = ohauth.headerGenerator({
consumer_key: '...',
consumer_secret: '...'
});

// pass just the data to produce the OAuth header with optional
// POST data (as long as it'll be form-urlencoded in the request)
var header = auth('GET', 'http://.../?a=1&b=2', { c: 3, d: 4 });
// or pass the POST data as an form-urlencoded string
var header = auth('GET', 'http://.../?a=1&b=2', 'c=3&d=4');
```

It works on https://api.howareyou.com

The code doesn't alter any of old functions. Any comments/critiques are welcome :)