The apiary-http-client package

[ Tags: library, mit, web ] [ Propose Tags ]

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.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.1.3.0
Dependencies apiary (>=1.4 && <3.0), base (>=4.6 && <4.9), bytestring (==0.10.*), bytestring-builder (==0.10.*), http-client (==0.5.*), http-types (>=0.8), text (>=1.1 && <1.3), transformers (>=0.2 && <0.5), types-compat (==0.1.*), wai (>=3.0 && <3.3) [details]
License MIT
Author winterland
Maintainer winterland1989@gmail.com
Category Web
Home page https://github.com/winterland1989/apiary-http-client
Source repository head: git clone https://github.com/winterland1989/apiary-http-client.git
Uploaded Wed Aug 10 11:49:05 UTC 2016 by winterland
Distributions NixOS:0.1.3.0
Downloads 200 total (6 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-10-26 [all 4 reports]
Hackage Matrix CI

Modules

  • Web
    • Apiary
      • HTTP
        • Web.Apiary.HTTP.Client

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for apiary-http-client-0.1.3.0

[back to package description]

Apiary HTTP Client

Hackage Travis-CI

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

import Web.Apiary
import Network.Wai.Handler.Warp
import Web.Apiary.HTTP.Client as HTTP

main :: IO ()
main = runApiaryWith (run 8080) (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 "api.backend.com" . HTTP.setPort 80 $ req

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