Skip to content

Commit

Permalink
refactor(service): EncodeResponse remove unnecessary case
Browse files Browse the repository at this point in the history
  • Loading branch information
d11-amitsingh committed Apr 14, 2021
1 parent c52bb87 commit bb68ef8
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions zio-http/src/main/scala/zhttp/service/EncodeResponse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait EncodeResponse {
jh.set(hh.name, hh.value)
}
val jStatus = res.status.toJHttpStatus
val response = res.content match {
res.content match {
case HttpContent.Complete(data) =>
jHttpHeaders.set(JHttpHeaderNames.CONTENT_LENGTH, data.length())
jHttpHeaders.set(JHttpHeaderNames.SERVER, SERVER_NAME)
Expand All @@ -42,12 +42,6 @@ trait EncodeResponse {
jHttpHeaders.set(JHttpHeaderNames.SERVER, SERVER_NAME)
jHttpHeaders.set(JHttpHeaderNames.DATE, s"${DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.now)}")
new JDefaultHttpResponse(jVersion, jStatus, jHttpHeaders)
case _ =>
jHttpHeaders.set(JHttpHeaderNames.CONTENT_LENGTH, 0)

new JDefaultFullHttpResponse(jVersion, jStatus, JUnpooled.buffer(0), jHttpHeaders, jTrailingHeaders)
}

response
}
}

0 comments on commit bb68ef8

Please sign in to comment.