Skip to content

Commit d68055f

Browse files
committed
fix: sometimes header is not present
1 parent 98ebc3d commit d68055f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/opencov/plug/multipart_job.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ defmodule Librecov.Plug.MultipartJob do
2828
handle(content_type, conn)
2929
end
3030

31-
def handle("application/json", %{params: %{"json" => json}} = conn) when is_binary(json) do
31+
def handle("multipart/form-data", %{params: %{"json_file" => file}} = conn) do
3232
conn
33-
|> put_parsed_job(json)
33+
|> put_parsed_job(file |> read_file())
3434
end
3535

36-
def handle("multipart/form-data", %{params: %{"json_file" => file}} = conn) do
36+
def handle(_, %{params: %{"json" => json}} = conn) when is_binary(json) do
3737
conn
38-
|> put_parsed_job(file |> read_file())
38+
|> put_parsed_job(json)
3939
end
4040

4141
def handle(content_type, conn) do

0 commit comments

Comments
 (0)