apimock

Crates.ioapimock
lib.rsapimock
version2.6.5
sourcesrc
created_at2024-03-05 13:43:51.711209
updated_at2024-10-15 22:26:02.221289
descriptionAPI mock Server generating HTTP/JSON responses written in Rust
homepage
repositoryhttps://github.com/nabbisen/apimock-rs
max_upload_size
id1163120
size161,840
nabbisen (nabbisen)

documentation

README

apimock-rs

crates.io Documentation Dependency Status Releases Workflow License

Summary

HTTP server generating REST/JSON responses. Aims to be mocking helper to develop microservices and APIs. Written in Rust and based on hyper.

Run ./apimock or ./apimock -c apimock.toml to start the server. It is single small native binary. Multiple platforms are supported and no installation is required.

Screenshots

Server started to listen:

server starts

curl test result:

server responds

Features

1. Basic

  • GET / POST methods
  • Multiple paths
  • Multiple .json/.json5 files treated as JSON Response
  • based on hyper v1

2. Customization

  • Custom HTTP response codes: 3xx as redirects, and 4xx and 5xx as errors
  • Custom response headers which are reusable
  • Flexible responses with patterns and jsonpath queries. Even with the same API URL path, multiple responses can be returned. See url.paths_patterns
  • Can specify response time on all or each API path

3. Dynamic processing

4. Usability

  • Validates configuration: Missing JSON files, duplicate paths etc.
  • Prints out routing at startup
  • Describes request content on both HTTP headers and body (json or plain text) when verbose log is activated

Reference

Acknowledgements

Depends on:

tokio / hyper / toml / serde / serde_json / json5 / console. In addition, mdbook (as to workflows)

Commit count: 91

cargo fmt