Skip to content

Commit

Permalink
fix utf8 characters serialization issue
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardzhou committed Jun 1, 2018
1 parent 1882243 commit 81001de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/exvcr/handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ defmodule ExVCR.Handler do
defp get_response_from_server(request, recorder, record?) do
adapter = ExVCR.Recorder.options(recorder)[:adapter]
response = :meck.passthrough(request)
|> convert_body
|> adapter.hook_response_from_server
if record? do
raise_error_if_cassette_already_exists(recorder, inspect(request))
Expand All @@ -149,6 +150,11 @@ defmodule ExVCR.Handler do
response
end

defp convert_body(response) do
{status, code, headers, body} = response
{status, code, headers, IO.iodata_to_binary(body)}
end

defp ignore_request?(request, recorder) do
ignore_localhost = ExVCR.Recorder.options(recorder)[:ignore_localhost] || ExVCR.Setting.get(:ignore_localhost)
if ignore_localhost do
Expand Down

0 comments on commit 81001de

Please sign in to comment.