-
Notifications
You must be signed in to change notification settings - Fork 100
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
Additional message is sent to process when request times out #121
Comments
Hi. That's weird. HTTPotion would never send something that looks like How does the request call look like? |
This is how I send and handle response. defp request(encoded_obj, url, apikey) when is_bitstring(encoded_obj) do
headers =
if apikey,
do: [{"Content-Type", "application/json"}, {"apikey", apikey}],
else: [{"Content-Type", "application/json"}]
options = [body: encoded_obj, timeout: @timeout, body: encoded_obj, headers: headers]
url
|> HTTPotion.post(options)
|> handle_response()
end
defp request(nil, _url, _apikey) do
{:error, :nil_request}
end
defp handle_response(%HTTPotion.Response{status_code: 200, body: body}) do
{:ok, Helper.decode!(body)}
end
defp handle_response(%HTTPotion.Response{status_code: 204}) do
{:error, :empty_result}
end
defp handle_response(%HTTPotion.Response{status_code: 403}) do
{:error, :unauthorized}
end
defp handle_response(%HTTPotion.ErrorResponse{message: message}) do
{:error, message}
end
defp handle_response(resp) do
Logger.warn("Unkown response received: #{inspect(resp)}")
{:error, :unknown_response}
end I know it shouldn't, but the data in message looks like it comes from there. And I did not see this error before, until now that I switched to HTTPotion. |
I'm still having this issue. Any idea on how can I track this? |
There are many debugging tools. I don't know which is the best one. |
I'm having the same issue. My Genserver crashes because it sometimes receives an unhandled message from HTTPotion. It seems this issue comes from ibrowse. See the following ticket: cmullaparthi/ibrowse#36 |
I use a timeout of 500ms for a call to an external service.
Sometimes the request times out and that's fine, but then my GenServer recieves a message of the following format. Since I do not handle it, it crashes :(
Seems like it sends the result, when I don't need it anymore.
I read docs, and I am not using async requests for sure.
Is this an expected behaviour?
HTTPotion
is3.1.0
.The text was updated successfully, but these errors were encountered: