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

[BUG] Fix issue where string bodies were not parsed or compared correctly #42

Merged
merged 3 commits into from
Aug 15, 2024

Conversation

atainter
Copy link
Contributor

@atainter atainter commented Aug 14, 2024

Issue: String bodies would include escaped quotes in request data ("\"Hello, World!\"")
Fix: Do not json.Marshal body if it is of string type

Issue: String response bodies were only parsed as JSON objects
Fix: If json.Unmarshal fails and body is a string, compare as a string.

Other enhancements:

  • Added additional tests for fixes
  • Refactored switch statement in response comparer code to make it slightly more readable

suite.go Outdated Show resolved Hide resolved
"request": {
"method": "POST",
"url": "/users",
"body": "{{ test1.userId }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is using a template variable in the request body intentional here? Or is it intended to be a simple string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I meant to do this in the response body, but it was before I fixed the string issue. I'll change it.

@atainter atainter merged commit c09cac7 into master Aug 15, 2024
1 check passed
@atainter atainter deleted the at-fix-string-body branch August 15, 2024 16:11
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

Successfully merging this pull request may close these issues.

2 participants