Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot extract keys when Content-type header is not set #147

Open
leorush opened this issue Aug 8, 2023 · 1 comment
Open

Cannot extract keys when Content-type header is not set #147

leorush opened this issue Aug 8, 2023 · 1 comment

Comments

@leorush
Copy link

leorush commented Aug 8, 2023

When Content-type header is not set, mmock cannot extract keys.

Example log:
{ "scheme": "http", "host": "1", "port": "80", "method": "POST", "path": "/jsonrpc/v1/payments.create", "queryStringParameters": {}, "fragment": "", "headers": { "Accept-Encoding": [ "gzip" ], "Authorization": [ "Basic cWE6cWE=" ], "Cache-Control": [ "no-cache" ], "Content-Length": [ "33" ], "Cookies": [ "{}" ], "User-Agent": [ "Go-http-client/1.1" ] }, "cookies": {}, "body": "{\"id\":\"e2a69502\",\"jsonrpc\":\"2.0\"}" }

Mapping:

{"id": "{{request.body.id}}", "jsonrpc": "{{request.body.jsonrpc}}"}

What mmock returns:
{"id": "{{request.body.id}}", "jsonrpc": "{{request.body.jsonrpc}}"}

P.S. Sorry, i got it wrong for the first time, because of escaped JSON in log

@leorush leorush changed the title Cannot extract keys from escaped body Cannot extract keys when Content-type header is not set Aug 8, 2023
@leorush
Copy link
Author

leorush commented Aug 8, 2023

Maybe create additional parameter to set default content, based on matched mapping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant