Purify buildRequest function

As an alternative to #9, make the `buildRequest` function pure, as requested by afcowie/http-streams#9 and elsewhere. See afcowie/http-streams#62 for the matching pull request showing the impact of the API break on the **http-streams** public API.

AfC