Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.
/ httmock Public archive

A minimal local HTTP testing and prototyping server

Notifications You must be signed in to change notification settings

benmezger/httmock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

httmock allows local testing and prototyping by mocking a HTTP server from a file based specification.

Installing

  1. Clone this repository: git clone https://github.com/benmezger/httmock:
  2. Run make install

Running

Make sure you have a .http.yaml in your current directory or pass a custom filename with --api-file

  • httmock serve or httmock --api-file <filename> serve

Use httmock serve --host localhost:8000 for using a different host/port.

Listing routes

For listing routes with their available params, use:

  • httmock list or httmock --api-file <filename> list

HTTP file syntax

For an example of the file structure, see example-http.yaml.

TODOs

  • Handle context base requests and responses

Example

Run httmock with the example file Then run curl against the defined URL paths:

  • curl -X GET http://localhost:8000/?name=name-param -d '{"msg": "Body of GET request"}' {"msg": "Hello, from / GET response"}

About

A minimal local HTTP testing and prototyping server

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published