Skip to content

Commit

Permalink
fix akka#4213: Content-Length when entity is unallowed
Browse files Browse the repository at this point in the history
  • Loading branch information
bursauxa committed Jan 12, 2023
1 parent 84af061 commit 471e6ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private[http] class HttpResponseRendererFactory(
}

def renderContentLengthHeader(contentLength: Long) =
if (status.allowsEntity) r ~~ ContentLengthBytes ~~ contentLength ~~ CrLf else r
if (status.allowsEntity) r ~~ ContentLengthBytes ~~ contentLength ~~ CrLf else r ~~ ContentLengthBytes ~~ 0 ~~ CrLf

def headersAndEntity(entityBytes: => Source[ByteString, Any]): StrictOrStreamed =
if (noEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ResponseRendererSpec extends AnyFreeSpec with Matchers with BeforeAndAfter
|Age: 0
|Server: akka-http/1.0.0
|Date: Thu, 25 Aug 2011 09:10:29 GMT
|Content-Length: 0
|
|"""
}
Expand Down

0 comments on commit 471e6ca

Please sign in to comment.