Skip to content

Commit

Permalink
Merge pull request #1067 from waseigo/HeadObject_fix
Browse files Browse the repository at this point in the history
Don't set content-length header for HEAD requests with empty body
  • Loading branch information
bernardd authored Sep 10, 2024
2 parents 94ccdc8 + 6a23dc2 commit b667b1d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ex_aws/operation/s3.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ defmodule ExAws.Operation.S3 do

defp put_content_length_header(headers, "", :get), do: headers

defp put_content_length_header(headers, "", :head), do: headers

defp put_content_length_header(headers, "", :delete), do: headers

defp put_content_length_header(headers, body, _) do
Map.put(headers, "content-length", IO.iodata_length(body) |> Integer.to_string())
end
Expand Down

0 comments on commit b667b1d

Please sign in to comment.