Skip to content

Commit

Permalink
Use correct variable when setting content length
Browse files Browse the repository at this point in the history
None is stringable so the previous code here would work, but, in
theory could eventually lead to "badness". The intent of the code
was to match on a USize | None and set the content length to the
string version of the USize if a USize.

However, it was setting to the string version of USize | None.
Given the match statement, this was fine for now, but, the intent
was clouded.

This could lead to a bug in the future if someone changed the code.
  • Loading branch information
SeanTAllen committed Feb 4, 2024
1 parent 0802950 commit a29303f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http_server/response.pony
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class val BuildableResponse is (Response & ByteSeqIter)
_content_length = cl
match cl
| let clu: USize =>
set_header("Content-Length", cl.string())
set_header("Content-Length", clu.string())
// | None =>
// TODO: drop header
end
Expand Down

0 comments on commit a29303f

Please sign in to comment.