Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/reverse_proxy/runner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ defmodule ReverseProxy.Runner do
defp process_response({:ok, response}, conn) do
conn
|> put_resp_headers(response.headers)
|> Conn.delete_resp_header("transfer-encoding")
|> Conn.send_resp(response.status_code, response.body)
end

Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/chunked_response.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule ReverseProxyTest.ChunkedResponse do
def request(_method, _url, _body, _headers, _opts \\ []) do
{:ok, %{
:headers => [{"transfer-encoding", "chunked"}],
:status_code => 200,
:body => ""
}}
end
end
11 changes: 11 additions & 0 deletions test/reverse_proxy/runner_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ defmodule ReverseProxy.RunnerTest do
assert conn.resp_body == "8000001"
end

test "retrieve/3 - chunked response" do
conn =
conn(:get, "/")
|> ReverseProxy.Runner.retreive(
["localhost"],
ReverseProxyTest.ChunkedResponse
)

assert get_resp_header(conn, "transfer-encoding") == []
end

test "retreive/3 - http - success with response headers" do
conn = conn(:get, "/")
headers = ReverseProxyTest.SuccessHTTP.headers
Expand Down