Closed maelle closed 1 year ago
That message comes from httr:::guess_encoding
, which is called in httr::content(x, as = "text")
if the content-type header doesn't specify a charset. All instances of httr::content()
in httptest are wrapped in suppressMessages()
to handle this.
Your gh_whoami()
test code calls gh:::gh_process_response
, which calls httr::content
. I suspect that's where the message is being raised, not from httptest.
Thanks a ton and sorry!
In a test with
with_mock_dir()
I get the message "No encoding supplied: defaulting to UTF-8." that I see is squelched forcapture_requests()
but not in this context.Repo https://github.com/maelle/msghttptest Test https://github.com/maelle/msghttptest/blob/main/tests/testthat/test-msg.R Snap https://github.com/maelle/msghttptest/blob/main/tests/testthat/_snaps/msg.md Mock file https://github.com/maelle/msghttptest/blob/main/tests/testthat/pr0/api.github.com/user.json