Questions tagged [httpoison]

for questions related to the HTTP client for Elixir

Yet Another HTTP client for Elixir powered by hackney

https://hex.pm/packages/httpoison


Maintainers

Eduardo Gurgel Pinho

Links

License

MIT

60 questions
2
votes
1 answer

Access Azure Storage Services REST API with Elixir and HTTPoison

I'm trying to use Elixir to access Azure Storage Services via their REST API but I'm having difficulty getting the Authentication Header to work. I am able to connect if I use the ex_azure package (wrapper for erlazure) but not when I try to build…
dwyd
  • 55
  • 2
  • 9
2
votes
1 answer

%HTTPoison.Error{id: nil, reason: :closed}

We are using HTTPoison in our code base for the post and get requests while using the hackney pool. Posting here is just because I want to get some opinions from all the experts. We are working with a lot of cameras, where, from each camera, we are…
Junaid Farooq
  • 2,484
  • 5
  • 26
  • 63
2
votes
1 answer

start erlang/elixir on a defined interface ip address

I'm using elixir to make some XMLRPC queries to an host on my machine that accepts only call from 127.0.x.y where x and y can be configurable but the ip can not be 127.0.0.1. Simple curl requests to this host would fail unless I add the flag…
Red
  • 664
  • 2
  • 10
  • 20
2
votes
1 answer

pattern match HTTpoison response Elixir

Is there any way that we can pattern match the error response of httpoison ? I was doing this case HTTPoison.get!(url, [], []) do %HTTPoison.Error{reason: reason} -> IO.inspect "Media: #{reason}!" :timer.sleep(:timer.seconds(3)) …
Junaid Farooq
  • 2,484
  • 5
  • 26
  • 63
1
vote
1 answer

Elixir HTTPoisin.get avoid dedup in response data

I am making call to HTTP Rest API in elixir url = "http://localhost:8080/getScoreData" case HTTPoison.get(url) do {:ok, %{status_code: 200, body: body}} -> Logger.info("body is #{inspect(body)}") overall_score =…
veer7
  • 20,074
  • 9
  • 46
  • 74
1
vote
1 answer

HTTPoison - getting different response than a browser

I'm doing: HTTPoison.get! "https://www.nature.com/articles/d41586-020-00741-x" Which works fine in the browser but gives me a 303 when I try and fetch the page with HTTPoison. What am I doing wrong?
cjm2671
  • 18,348
  • 31
  • 102
  • 161
1
vote
2 answers

Catching HTTPoison errors with invalid port range

Encountered a situation where the url passed to get contains an invalid port iex> HTTPoison.get("http://example.com:650000") ** (FunctionClauseError) no function clause matching in :inet_tcp.do_connect/4 (kernel) inet_tcp.erl:113:…
Lars KJ
  • 632
  • 7
  • 15
1
vote
1 answer

How to transform CURL request to Httpoison request in Elixir Phoenix

I'm trying to transform CURL request with HTTPoison in Elixir Phoenix. When I run CURL request commend, It work fine.I got "415 Unsupported media type" error when I try with HTTPoison. Phoenix/Elixir - cURL works, but HTTPoison fails Here is my CURL…
Thatoe Aung
  • 167
  • 4
  • 12
1
vote
1 answer

How to mock HTTPoison with Mox?

Background I have library that uses HTTPoison for some functionality I need to test. To achieve this I am using Mox, which I believe is the universal mocking library for Elixir (even though there are others this one has the seal of approval of José…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
1
vote
1 answer

how to make post request using tesla in elixir

I'm trying to make post request using tesla but getting error: (CaseClauseError) no case clause matching: %{name: "ecdebit"} (hackney) /deps/hackney/src/hackney_request.erl:312::hackney_request.handle_body/4 (hackney)…
Rana. Amir
  • 187
  • 3
  • 15
1
vote
1 answer

How to limit the the rate HTTPoison, or hackney, streams a response when using the `stream_to` option

I have a client consuming a chunked HTTP response. HTTPoison.request(method, url, body, headers, stream_to: self(), timeout: 50_000, recv_timeout: 50_000) However HTTPoison is able send messages to the process quicker than we can process them. The…
Peter Saxton
  • 4,466
  • 5
  • 33
  • 51
1
vote
2 answers

Elixir POST file to Heroku file Attachment Scanner add-on

I am trying to scan uploaded documents for viruses when a user uploads, using the Heroku Add-on Attachment Scanner. I am attempting to encode the file directly with Poison.encode, but it is throwing an error so am not sure this is the correct…
JMurphyWeb
  • 382
  • 1
  • 11
1
vote
2 answers

Getting argument error when fetching data from API and decoding with Poison

I am new to Elixir/Phoenix and trying to learn by building a small app. I am fetching data from a 3rd party API and keep getting the following error. (ArgumentError) argument error :erlang.iolist_to_binary([%{"24h_volume" => "1000", "name" =>…
alexts
  • 180
  • 2
  • 13
1
vote
2 answers

Can the port be specified for localhost using HTTPoison?

I'm working with a test in which I need to hit a service I'm running locally. The service is a rails application with a JSON api exposed. It's running on port 3000. When I execute this elixir code I get an error: json_event =
jaydel
  • 14,389
  • 14
  • 62
  • 98
1
vote
1 answer

HTTPoison.get() error in Elixir

I have the following URL https://www.michaelkors.com/four-in-one-logo-belt-box-set/_/R-US_39F6LBLY4B?color=0200 And need to get the page body via HTTPoison.get. The following method gives an timeout error case…
RN92
  • 1,380
  • 1
  • 13
  • 32