Popularity
4.1
Growing
Activity
0.0
Stable
6
4
0

Monthly Downloads: 16
Programming language: Haskell
License: MIT License
Tags: Web     Apiary    

apiary-http-client alternatives and similar packages

Based on the "apiary" category.
Alternatively, view apiary-http-client alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of apiary-http-client or a related project?

Add another 'apiary' Package

README

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'