apiary-http-client: A http client for Apiary.

[ library, mit, web ] [ Propose Tags ]

[Skip to Readme]
Versions [RSS] [faq] 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.1.3.0, 0.1.4.0
Dependencies apiary (>=1.0.0), base (==4.8.*), bytestring, data-default-class, http-client (>=0.4.26), http-types (>=0.8), text, transformers, types-compat (==0.1.*), wai [details]
License MIT
Author winterland
Maintainer winterland1989@gmail.com
Category Web
Home page https://github.com/winterland1989/apiary-http-client
Uploaded by winterland at 2016-03-15T10:32:10Z
Distributions NixOS:0.1.4.0
Downloads 3513 total (30 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2016-03-15 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Candidates


Readme for apiary-http-client-0.1.0.0

[back to package description]

Apiary HTTP Client

A HTTP Client for Apiary, using Apiary's extension api, suitable for proxying HTTP request to backend API, with flexible APIs and streamming proxying abilities.

This module also reexport Network.HTTP.Client. Example:

main :: IO ()
main = runApiaryWith (run serverPort) (HTTP.initHTTPClient HTTP.defaultManagerSettings) def $ do

    [capture|/query|] . action $ do
        
        -- make a new Network.HTTP.Client.Request from current ActionT's Network.Wai.Request
        -- it's recommended to use resetHeaders to remove following headers:
        -- Transfer-Encoding, Content-Length, Content-Encoding and Accept-Encoding.
        req <- HTTP.fromRequest id resetHeaders

        -- set proxying host and port
        -- use function from Network.HTTP.Client to modify more
        let req' = HTTP.setHost influxDB_API_HOST . HTTP.setPort 80 $ req

        -- send request and proxy respond in streamming fashion.
        HTTP.proxyTo req'

More document are W.I.P.