Skip to content

Commit

Permalink
apply fix to copy-pasted method
Browse files Browse the repository at this point in the history
  • Loading branch information
NavidJalali committed Oct 27, 2024
1 parent 5d5b203 commit ff0042f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ object PekkoHttpServerProviderScala extends PekkoHttpServerProvider with Directi
case _ =>
response
.attribute(AttributeKeys.trailer)
.map(trailer => Trailer(f(trailer.headers.map((RawHeader.apply _).tupled))))
.map(trailer => f(trailer.headers.map((RawHeader.apply _).tupled)))
.flatMap(headers => if (headers.isEmpty) None else Some(Trailer(headers)))
.fold(response)(response.addAttribute(AttributeKeys.trailer, _))
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ object PekkoHttpServerProviderScala extends PekkoHttpServerProvider {
HttpEntity.LastChunk(last.extension, f(last.trailer))
}))
case _ =>
val origTrailers = response
response
.attribute(AttributeKeys.trailer)
.map(_.headers)
.getOrElse(Vector.empty)
.map(e => RawHeader(e._1, e._2))
response.addAttribute(AttributeKeys.trailer, Trailer(f(origTrailers)))
.map(trailer => f(trailer.headers.map((RawHeader.apply _).tupled)))
.flatMap(headers => if (headers.isEmpty) None else Some(Trailer(headers)))
.fold(response)(response.addAttribute(AttributeKeys.trailer, _))
})
}

Expand Down

0 comments on commit ff0042f

Please sign in to comment.