Open ZsoltMaslanyi opened 4 years ago
Please share an example code, these is little I can do with the given information.
I'm also not sure if this is a feature, or a bug. Please clarify.
Hi @teamon , thanks for taking the time to check this!
Sorry if it wasn't obvious from the description, here's the example code:
defmodule TeslaClient do
use Tesla
adapter(Tesla.Adapter.Mint)
def get_example_http2_site() do
get("https://remoteok.io")
end
end
TeslaClient.get_example_http2_site()
The error message is the same as the original post I wrote. The Mint adapter's reduce_responses/3 gets called with :push_promise to push down content on the connection, but the response is not handled by the adapter.
Re for if it's a feature request or a bug - I'd go with feature request, but you'll be the judge. Tesla does have a Mint adapter, but it fails to work on any HTTP2 sites.
Confirmed:
iex(5)> Tesla.get(client, "https://remoteok.com")
** (FunctionClauseError) no function clause matching in anonymous fn/2 in Tesla.Adapter.Mint.reduce_responses/3
The following arguments were given to anonymous fn/2 in Tesla.Adapter.Mint.reduce_responses/3:
# 1
{:push_promise, #Reference<0.179896103.3862429701.90397>,
#Reference<0.179896103.3862429701.90400>,
[
{":method", "GET"},
{":path", "/global.css?1639217940"},
{":scheme", "https"},
{":authority", "remoteok.com"},
{"user-agent", "mint/1.3.0"}
]}
# 2
%{}
(tesla 1.4.3) lib/tesla/adapter/mint.ex:328: anonymous fn/2 in Tesla.Adapter.Mint.reduce_responses/3
(elixir 1.12.3) lib/enum.ex:2385: Enum."-reduce/3-lists^foldl/2-0-"/3
(tesla 1.4.3) lib/tesla/adapter/mint.ex:298: Tesla.Adapter.Mint.receive_packet/4
(tesla 1.4.3) lib/tesla/adapter/mint.ex:258: Tesla.Adapter.Mint.receive_responses/4
(tesla 1.4.3) lib/tesla/adapter/mint.ex:197: Tesla.Adapter.Mint.format_response/3
(tesla 1.4.3) lib/tesla/adapter/mint.ex:59: Tesla.Adapter.Mint.call/2
I tried to replicate this: https://gist.github.com/yordis/ea7226110cc578e4372845e3dffd92d3#file-elixir-tesla-tesla-pull-591-livemd
But it seems to be working just fine.
Hi guys,
This is a feature request that I can't take on on my own.
The Mint adapter does not support HTTP2 push messages and I haven't found a way to disable it through the adapter configuration.