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

nabbisen - Feb 12 - - Dev Community

I released json-responder 1.1.0.

GitHub logo nabbisen / apimock-rs

API mock Server generating HTTP/JSON responses written in Rust

apimock-rs

crates.io Documentation Dependency Status Releases Workflow License

Summary

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

With small native binary, just run ./apimock or ./apimock -c apimock.toml to start the server !

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…

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 ☺

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player