mock-httpd alternatives and similar packages
Based on the "network" category.
Alternatively, view mock-httpd alternatives based on common mentions on social networks and blogs.
-
compendium-client
Mu (μ) is a purely functional framework for building micro services. -
resolv
Domain Name Service (DNS) lookup via the libresolv standard library routines -
nakadi-client
Haskell Client Library for the Nakadi Event Broker -
windns
Domain Name Service (DNS) lookup via the Windows dnsapi standard library -
network-data
Network data structures in Haskell (IP, UDP, TCP headers, etc) -
network-uri-json
FromJSON and ToJSON Instances for Network.URI -
hatexmpp3
XMPP client with synthetic filesystem (9P) and (optional) graphical (GTK3) interfaces -
hsendxmpp
sendxmpp clone and drop-in replacement, sending XMPP messages via CLI -
LDAPv3
Lightweight Directory Access Protocol V3 (LDAPv3) RFC4511 implementation -
attoparsec-uri
A compositional URI parser / printer for attoparsec -
transient-universe-tls
Secure communications for transient-universe -
iwlib
A binding to the iw library for getting info about the current WiFi connection. -
network-simple-wss
Simple Haskell interface to TLS secured WebSockets -
network-uri-lenses
lenses for http://hackage.haskell.org/package/network-uri -
oauth2-jwt-bearer
OAuth2 jwt-bearer client flow as per rfc7523. -
percent-encoder
A simple, fast percent encoder/decoder for bytestrings
WorkOS - The modern identity platform for B2B SaaS
Do you think we are missing an alternative of mock-httpd or a related project?
README
A Tiny HTTP Server for Testing HTTP Clients
Given a configuration file describing routes and actions, mock-httpd
will bind to the specified ports and respond to incoming HTTP
requests.
The primary goal of this project is to provide a simple way to test shell scripts that use curl.
Configuration
A YAML configuration file is used to control mock-httpd
. The file
is split between general configuration and routing information.
General Configuration
The following settings control all requests:
listen
: An array of directives, each of which causesmock-httpd
to bind to a port and listen for requests.Example:
listen: - port: 3210
directory
: A path to a directory where files can be read from and written to. All routing actions involving files are restricted to this directory.
An [example configuration](example.yml) is included with the distribution.
Routing Information
The routing
section of the configuration file is used to match
incoming requests and perform corresponding actions.
Example:
routes:
- match_path: /hello
match_method: GET
actions:
- serve_text: "Hello World!\n"
- content_type: text/plain
Route Matching
Match directives (properties starting with match_
) are used to
select actions to perform for incoming requests. All listed match
directives must match the incoming request in order for the containing
route's actions to be performed. Only the first matching route is used.
match_path
: Exact string comparison with the requested path.match_method
: Exact string comparison with the request method.
Actions
The following actions can be taken when a route matches:
serve_file: path
: Send the specified file back to the client.serve_text: text
: Send arbitrary text back to the client.location: url
: Set theLocation
header.content_type: type
: Set theContent-Type
header.set_headers: hash
: Set each entry in the specified hash as a response header.response_code: code
: Set the response code tocode
.save_body: path
: Write the request body to the specified file.
NOTE: The serve_*
actions are mutually exclusive and only the
first one will be used. If no serve_*
action is specified the
default action is to respond with an empty body.