Closed ernstam closed 5 years ago
Hi Ernst! what would be the expected behavior? Have you tried to pass the non-double-backslashed character, like
let stub = { urlPattern: '\d' }
Marco,
You're absolutely right. In my noobishness, I forgot that the Json, I send to wiremock, itself needs an escaped backslash too.
Anyway, thanks for the quick reply. And good luck with the project. I got the wiremock connection with my protractor test working, by the way.
Kind regards, Ernst Stam
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Wednesday 19 December 2018 15:23, Marco Dalla Vecchia notifications@github.com wrote:
Hi Ernst! what would be the expected behavior? Have you tried to pass the non-double-backslashed character, like
let stub = { urlPattern: '\d' }
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Dear marco and Sudharsan,
I was gratefully using protractor-http-client for a front-end application test to talk with a wiremock instance running on the same server. I noticed that, when trying to post an urlPattern, the escaped characters ('\d' for instance) are not transformed properly. Here's a dummy example.
wiremock.getHttpClient().post('mappings', '{ "urlPattern": "\\d" }', headers);
will work and results in 'Received request to /mappings with body { 'urlPattern': \d }', but
let stub = { 'urlPattern': '\\d' }; wiremock.getHttpClient().post('mappings', stub, headers);
fails and results in 'Received request to /mappings with body {"urlPattern":"\d"}'
note the double backslash.
Obviously the workaround could be to enter the entire stub (which is more complex than the dummy example) as a string, but JSON.stringify is also useless and shows the same behaviour and will prove to be quite the fiddle.
I'm not sure if this is a bug, but if fixed it would open many possibilities for using your package together with wiremock.
Regards, Ernst Stam