Skip to content

Commit

Permalink
Fix Bandit.HTTP1.Adapter.inform/3 return value (#268)
Browse files Browse the repository at this point in the history
* Fix Bandit.HTTP1.Adapter.inform/3 return value

Per https://hexdocs.pm/plug/Plug.Conn.Adapter.html#c:inform/3, the
callback should return:

    :ok | {:error, :not_supported}

The way Plug.Conn.inform! is implemented at the moment,
https://github.com/elixir-plug/plug/blob/v1.15.2/lib/plug/conn.ex#L1335,
it looked like Bandit did _not_ implement inform but it sure does!

* Update
  • Loading branch information
wojtekmach committed Jan 16, 2024
1 parent d2c7408 commit bfffb65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bandit/http1/adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ defmodule Bandit.HTTP1.Adapter do
|> Map.put(:resp_start_time, start_time)
|> Map.put(:resp_body_bytes, 0)

{:ok, nil, %{req | metrics: metrics}}
{:ok, %{req | metrics: metrics}}
end

defp response_header(nil, status, headers), do: response_header("HTTP/1.0", status, headers)
Expand Down

0 comments on commit bfffb65

Please sign in to comment.