svenstaro / dummyhttp

Super simple HTTP server that replies a fixed body with a fixed response code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: A way to add minor dynamic data

bjmc opened this issue · comments

I'm trying to test a service that calls an upstream API, gets an ID and stores some data for processing later. I was going to use dummyhttp to replace the upstream API, but unfortunately because of deduplication logic, this only works once:

./dummyhttp -b '{"id": "b76bf160-f8fe-4acf-83a5-9b6cdee6cc97", "location": "https://example.org/b76bf160-f8fe-4acf-83a5-9b6cdee6cc97"}' -h "content-type:application/json"

I'd love to have something like:

./dummyhttp -b '{"id": "<UUID>", "location": "https://example.org/<UUID>"}' -h "content-type:application/json" where it would dynamically create a new id for each response.

I know this feature could rapidly spiral into an absurdly complex DSL, but maybe just supporting UUIDs and ISO timestamps?

I think that would work yep. You're in luck, too, as I'm currently rewriting dummyhttp so I will consider this!