DEV Community

nabbisen
nabbisen

Posted on • Updated on

apimock-rs (former json-responder) 1.1: dynamic path resolution

I released json-responder 1.1.0.

GitHub logo nabbisen / apimock-rs

API mock Server generating HTTP/JSON responses written in Rust

apimock-rs

Mocking helper to develop microservices and APIs. hyper-based HTTP server generating REST responses containing JSON ones. Written in Rust.

License

Summary

Aims to help developers to easily get responses from dummy API, especially microservice API, according to several paths Each single executable on Win/Mac/Linux are available, thanks to Rust and their cross-platform support. Releases are "out-of-the-box" coming with default config apimock.toml.

* Renamed from json-responder. Now more than returning JSON data.

Screenshots

Server started to listen:

server starts

curl test result:

server responds

Designed in mind with

  • Performance
    • Fast speed
    • Low memory consumption
  • Easy setup/usage
    • Built as single (and small) executable
    • Integrated configuration
      • No need to write scripts
      • Config-less mode is also supported
  • Cross-platform support

Features

  • GET / POST methods
  • Multiple paths
  • Multiple .json/.json5 files treated as JSON Response
  • Dynamic path resolution with dyn_data_dir
  • Custom responses codes (HTTP 3xx as redirects and 4xx and 5xx as errors)
  • Custom headers and…

This release contains new feature to resolve path dynamically when dyn_data_dir is activated.

It means the server automatically returns .json / .json5 responses under dyn_data_dir.

Supposed that there is:

json-responder-data (as `dyn_data_dir`)
├── a
│   └── b
│       └── c.json5
└── a.json
Enter fullscreen mode Exit fullscreen mode

the responses at requests are:

request path response content
/a a.json
/a/b (HTTP 404)
/a/b/c c.json5

Now you don't have to write in config all paths you want to use in API tests ☺

Top comments (1)

Collapse
 
nabbisen profile image
nabbisen

Renamed to apimock-rs. Now more than returning JSON data.

github.com/nabbisen/apimock-rs