mmock icon indicating copy to clipboard operation
mmock copied to clipboard

Cannot extract keys when Content-type header is not set

Open leorush opened this issue 2 years ago • 1 comments

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 avatar Aug 08 '23 11:08 leorush

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

leorush avatar Aug 08 '23 20:08 leorush