Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hackney Converter: Options sanitization fails #70

Open
eniolopes opened this issue Aug 1, 2016 · 2 comments
Open

Hackney Converter: Options sanitization fails #70

eniolopes opened this issue Aug 1, 2016 · 2 comments

Comments

@eniolopes
Copy link

When doing a request using hackney I get the following error:

** (FunctionClauseError) no function clause matching in anonymous fn/1 in ExVCR.Adapter.Hackney.Converter.sanitize_options/1
     stacktrace:
       lib/exvcr/adapter/hackney/converter.ex:35: anonymous fn(:with_body) in ExVCR.Adapter.Hackney.Converter.sanitize_options/1
       (elixir) lib/enum.ex:1184: 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(:get, "...", [...], "", [:with_body, {:max_body, 30000000}])

Error is happening because the function sanitize_options/1, here, is expecting a list of tuples, but hackney also accepts single atoms as values.

@parroty
Copy link
Owner

parroty commented Aug 5, 2016

Thanks for the report. Is it possible for you to post an example request? (which corresponds to your error).

Also, I'm looking around the hackney spec and it seems to be noted as list.
https://github.com/benoitc/hackney/blob/master/doc/hackney.md#request5

@digaoddc
Copy link

digaoddc commented Nov 1, 2016

@parroty
It is happening with POST requests and hackney .
If you write a test in ExVCR.Adapter.HackneyTest, with the following request, it will probably fail .

:hackney.request(:post, "https://mydomain.com", [], "{}", [:insecure] )

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

No branches or pull requests

3 participants