All Projects → owainlewis → Http Dispatch

owainlewis / Http Dispatch

Licence: other
A high level HTTP client for Haskell that focuses on ease of use

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to Http Dispatch

Mint
Functional HTTP client for Elixir with support for HTTP/1 and HTTP/2.
Stars: ✭ 969 (+1462.9%)
Mutual labels:  http-client
Oh My Request
🔮 simple request library by java8
Stars: ✭ 44 (-29.03%)
Mutual labels:  http-client
Http Client Contracts
A set of HTTP client abstractions extracted out of the Symfony components
Stars: ✭ 1,078 (+1638.71%)
Mutual labels:  http-client
Restful.js
A pure JS client for interacting with server-side RESTful resources. Think Restangular without Angular.
Stars: ✭ 977 (+1475.81%)
Mutual labels:  http-client
Jiny
Lightweight, modern, simple JVM web framework for rapid development in the API era
Stars: ✭ 40 (-35.48%)
Mutual labels:  http-client
Cross Fetch
Universal WHATWG Fetch API for Node, Browsers and React Native.
Stars: ✭ 1,063 (+1614.52%)
Mutual labels:  http-client
Easyhttp
A Laravel HTTP-client to make HTTP request easier and log requests and responses
Stars: ✭ 20 (-67.74%)
Mutual labels:  http-client
Lush Http
Smart Http Client for PHP
Stars: ✭ 60 (-3.23%)
Mutual labels:  http-client
Easygo
基于Kotlin、OkHttp的声明式网络框架,像写HTML界面一样写网络调用代码
Stars: ✭ 40 (-35.48%)
Mutual labels:  http-client
Http
A smart, simple and fault-tolerant HTTP client for sending and receiving JSON and XML
Stars: ✭ 53 (-14.52%)
Mutual labels:  http-client
Xmnetworking
A lightweight but powerful network library with simplified and expressive syntax based on AFNetworking.
Stars: ✭ 980 (+1480.65%)
Mutual labels:  http-client
Lifxhttpkit
A nice iOS/watchOS/macOS framework for interacting with the LIFX HTTP API that has no external dependencies.
Stars: ✭ 38 (-38.71%)
Mutual labels:  http-client
Hreq
A type dependent highlevel HTTP client library inspired by servant-client.
Stars: ✭ 53 (-14.52%)
Mutual labels:  http-client
Create Request
Apply interceptors to `fetch` and create a custom request function.
Stars: ✭ 34 (-45.16%)
Mutual labels:  http-client
Foxy
Session-based Beast/Asio wrapper requiring C++14
Stars: ✭ 57 (-8.06%)
Mutual labels:  http-client
Hoppscotch
👽 Open source API development ecosystem https://hoppscotch.io
Stars: ✭ 34,569 (+55656.45%)
Mutual labels:  http-client
Tech1 Benchmarks
Java JMH Benchmarks repository. No Longer Supported.
Stars: ✭ 50 (-19.35%)
Mutual labels:  http-client
Flogo Contrib
Flogo Contribution repo. Contains activities, triggers, models and actions.
Stars: ✭ 60 (-3.23%)
Mutual labels:  http-client
Http Prompt
An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie
Stars: ✭ 8,329 (+13333.87%)
Mutual labels:  http-client
Json Api Dart
JSON:API client for Dart/Flutter
Stars: ✭ 53 (-14.52%)
Mutual labels:  http-client

HTTP Dispatch

This is the HTTP library I wish I had when first learning Haskell

CircleCI

Available on Hackage: You'll want to use a version at 0.6.2.0 or greater

https://hackage.haskell.org/package/http-dispatch-0.6.2.0

A high level Haskell HTTP client with a friendly and consistent API. This library builds upon the http-client library, providing an (IMO) easier and more intuative API

There are only two types (HTTPRequest and HTTPResponse). Everything else is sugar for constructing these types

Differences from http-client

  • Simple DSL (only two types HTTPRequest and HTTPResponse)
  • Higher level API
  • No exceptions thrown on non 200 status codes
  • Supports TLS out of the box

Differences from wreq

  • Lighter
  • Doesn't require lens package

Motivation

There are already a couple of really good HTTP clients for Haskell (Wreq, HTTP Client), but typically I'd need to go hunting through documentation just to do even the simplest thing (or having to import a different package for https). This is the HTTP library I wish I had when first learning Haskell.

This library strips back everything to be as simple as possible. It will transparently support HTTPS and has a very consistent DSL for making requests.

There are only two types. A HTTPRequest and a HTTPResponse. That's all there is to know about this library.

Some utility functions are provided to make constructing requests easier but it's nothing more than sugar for creating types.

HTTP Request

A HTTP request has a method, url, a list of headers and an optional body. Header is a type synonym for a ByteString pair i.e (S.ByteString, S.ByteString). The body is a strict ByteString.

data HTTPRequest = HTTPRequest {
    method  :: RequestMethod
  , url     :: String
  , headers :: [(S.ByteString, S.ByteString)]
  , body    :: Maybe S.ByteString
} deriving ( Eq, Ord, Show )

HTTP Response

A HTTP response has a status, a list of headers, and a response body. Header is a type synonym for a ByteString pair i.e (S.ByteString, S.ByteString). The body is a strict ByteString.

data HTTPResponse = HTTPResponse {
    responseStatus  :: Int
  , responseHeaders :: [(S.ByteString, S.ByteString)]
  , resposeBody    :: S.ByteString
} deriving ( Eq, Show )

Examples

Some examples to help you get started.

Remember that everything is just sugar for constructing the HTTPRequest type and calling run on it to convert it to a IO HttpResponse.

{-# LANGUAGE OverloadedStrings #-}
module Example

import qualified          Network.HTTP.Dispatch as Dispatch

response :: IO Dispatch.HttpResponse
response = http request where reqeuest = get "http://google.com"

If you have any questions comments or feedback let me know [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].