parroty / exvcr

HTTP request/response recording library for elixir, inspired by VCR.
MIT License
722 stars 132 forks source link

Compression problems / problems with gzip #80

Open lukaselmer opened 7 years ago

lukaselmer commented 7 years ago

The following test fails

  test "test use_casette with HTTPotion and gzip compression" do
    use_cassette "api_stackexchange_com" do
      HTTPotion.start
      response = :zlib.gunzip(HTTPotion.get("https://api.stackexchange.com/2.2").body)
      assert response =~ "bad_parameter"
    end
  end

with the following error

  1) test test use_casette with HTTPotion and gzip compression (DevQuotes.DataSourceControllerTest)
     test/controllers/data_source_controller_test.exs:36
     ** (ErlangError) erlang error: :data_error
     stacktrace:
       :zlib.call/3
       :zlib.inflate/2
       :zlib.gunzip/1
       lib/exvcr/json.ex:24: ExVCR.JSON.gunzip_recording/1
       (elixir) lib/enum.ex:1184: Enum."-map/2-lists^map/1-0-"/2
       lib/exvcr/json.ex:11: ExVCR.JSON.save/2
       test/controllers/data_source_controller_test.exs:37: (test)

Any idea on how to fix this?