parroty / exvcr

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

Error with a file upload request #122

Open mrkaspa opened 6 years ago

mrkaspa commented 6 years ago

I was testing a request that makes S3 file upload:

path
    |> S3.Upload.stream_file()
    |> S3.upload("liftit-bkt", "bills/#{serial}.pdf")
    |> ExAws.request()

But it generates this issuer when recording the cassete

1) test #generate_upload_bill should store the bill on aws (Payments.Helper.PdfHelperTest)
     test/helper/pdf_helper_test.exs:13
     ** (FunctionClauseError) no function clause matching in anonymous fn/1 in ExVCR.Adapter.Hackney.Converter.sanitize_options/1

     The following arguments were given to anonymous fn/1 in ExVCR.Adapter.Hackney.Converter.sanitize_options/1:

         # 1
         :with_body

     code: assert {:ok, _} = PdfHelper.generate_upload_bill(bill)
     stacktrace:
       lib/exvcr/adapter/hackney/converter.ex:35: anonymous fn/1 in ExVCR.Adapter.Hackney.Converter.sanitize_options/1
       (elixir) lib/enum.ex:1255: Enum."-map/2-lists^map/1-0-"/2
       lib/exvcr/adapter/hackney/converter.ex:29: ExVCR.Adapter.Hackney.Converter.request_to_string/1
       lib/exvcr/adapter/hackney/converter.ex:6: ExVCR.Adapter.Hackney.Converter.convert_to_string/2
       lib/exvcr/handler.ex:137: ExVCR.Handler.get_response_from_server/2
       (hackney) :hackney.request(:post, "https://s3.amazonaws.com/liftit-bkt/bills/1000.pdf?uploads=1", [{"Authorization", "AWS4-HMAC-SHA256 Credential=AKIAILQC3UH4WFCATJWA/20170919/us-east-1/s3/aws4_request,SignedHeaders=content-length;host;x-amz-content-sha256;x-amz-date,Signature=8013f99d6a7bb67916dbc41c40ece438175ad3ae2fc3a8c5a9ed3c77d357e21b"}, {"host", "s3.amazonaws.com"}, {"x-amz-date", "20170919T200602Z"}, {"content-length", 0}, {"x-amz-content-sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}], "", [:with_body, {:recv_timeout, 30000}])
       (ex_aws) lib/ex_aws/request/hackney.ex:20: ExAws.Request.Hackney.request/5
       (ex_aws) lib/ex_aws/request.ex:38: ExAws.Request.request_and_retry/7
       (ex_aws) lib/ex_aws/operation/s3.ex:40: ExAws.Operation.ExAws.Operation.S3.perform/2
       (ex_aws) lib/ex_aws/s3/upload.ex:40: ExAws.S3.Upload.initialize/2
       (ex_aws) lib/ex_aws/s3/upload.ex:82: ExAws.Operation.ExAws.S3.Upload.perform/2
       test/helper/pdf_helper_test.exs:17: (test)