-
-
Notifications
You must be signed in to change notification settings - Fork 753
Description
Recent version added a change to parse dot notation in post body: 9004e33
API in our project uses dots in params and this change caused our existing tests to fail, because we used to do things like:
api.post(`/path`, { 'ws.op': 'value' })
.reply(200, { /* something */ }
After some investigation I found out that it was introduced by this commit 9004e33 and that I can fix it by updating our tests to:
api.post(`/path`, { 'ws': { 'op': 'value' } })
.reply(200, { /* something */ }
Still, it's not good that minor version change is causing existing test to break.
More so, right now parsing body is not consistent with query.
While the body of post requests is parsed with dot notation it seems that query is not, so while we have to break ws.op into nested object in post body we still have to use ws.op as one when mocking query of get requests:
api.get('/path')
.query({ 'ws.op': 'value' })
It would be good if both are consistent.
And possibly parsing dot notation should be optional/configurable so existing tests can still work in old notation.