-
Notifications
You must be signed in to change notification settings - Fork 89
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
Feature/post with dynamic body #84
base: master
Are you sure you want to change the base?
Feature/post with dynamic body #84
Conversation
substitute Array.includes with Array.indexOf
… POST@[filename].mock
var data = fs.readFileSync(join(fullPath, file), { encoding: 'utf8' }); | ||
|
||
try { | ||
if (jsonBody === JSON.stringify(JSON.parse(data))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could change this check to if (JSON.stringify(JSON.parse(jsonBody)) === JSON.stringify(JSON.parse(data))) {
to avoid a falsy
result due to an extra white space or some other formatting detail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with that because without it, it couldn't work correctly (if some space character exist for example)
Hello. Any news for this PR? It will be great if we can use it under Windows 👍 Regards, |
Modified previously submitted PR #44 for responding to POST requests with different mocks based on the requests body. This should resolve #38. I haven't run in to issues on Windows.
I also updated some of the tests' mock folders to be a little more descriptive of what they were doing.
Lastly, I changed the file format for these mock files to be:
POST@[json file name without extension].mock