Skip to content

bodyEquals prints actual body.#1525

Merged
snoyberg merged 1 commit intoyesodweb:masterfrom
StevenXL:bodyequals
Jun 14, 2018
Merged

bodyEquals prints actual body.#1525
snoyberg merged 1 commit intoyesodweb:masterfrom
StevenXL:bodyequals

Conversation

@StevenXL
Copy link
Copy Markdown
Member

@StevenXL StevenXL commented Jun 14, 2018

Before submitting your PR, check that you've:

  • Bumped the version number

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

@StevenXL
Copy link
Copy Markdown
Member Author

Hoping to address #1495.

(simpleBody res) == encodeUtf8 (TL.pack text)
bodyEquals text = withResponse $ \ res -> do
let actual = simpleBody res
msg = concat ["Expected body to equal ", text, ". Actual is: ", BSL8.unpack actual]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense for display purposes to put text and actual on their own lines? Also, I think it would be better to use UTF8 decoding (maybe via decodeUtf8With lenientDecode) instead of Char8.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Changes made. Let me know what you think.

Copy link
Copy Markdown
Member

@snoyberg snoyberg left a comment

Choose a reason for hiding this comment

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

LGTM, let's merge when Travis goes green

@snoyberg snoyberg merged commit 0437ace into yesodweb:master Jun 14, 2018
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