Skip to content

Daenerys is a tool that lets you execute HTTP requests from static files

License

Notifications You must be signed in to change notification settings

owainlewis/daenerys

Repository files navigation

Daenerys

Daenerys is a command line application that converts static JSON documents into executable HTTP requests.

It lets you store complex API calls as simple JSON files. You might use it for functional testing of APIs or automating complex HTTP calls. It is heavily inspired by the Chrome Postman extension

ALL YOUR HTTP ARE BELONG TO JSON

Example

Lets create a text file containing a HTTP request that we can execute.

{
    "url": "http://requestb.in/p3lsnxp3",
    "method": "GET",
    "headers": { "Content-Type":  "application/json" },
    "body" : "HELLO WORLD"
}

We can now run this from the command line so:

stack build && stack exec daenerys-exe "examples/simple-get.json"

Low level API

Some of the Haskell HTTP libraries can border on overly complex sometimes.

Daenerys also provides a much nicer DSL for doing HTTP requests in Haskell with minimial fuss.

exampleRequest = InternalRequest {
    requestUrl    = "http://requestb.in/1d1a1121"
  , requestMethod = "GET"
  , headers = Just $ fromList [("Content-Type", "application/json")]
  , body = Just "HELLO WORLD"
}

response = runRequest exampleRequest

About

Daenerys is a tool that lets you execute HTTP requests from static files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published