pjfanning opened a new pull request, #1366:
URL: https://github.com/apache/pekko-http/pull/1366

   ### Motivation
   The Scala API only supported looking up headers by type (`header[T]`), so 
finding a custom or raw header by name required `headers.find(_.is(...))` with 
manual lower-casing. The Java API already has `getHeader(String)` and the Scala 
testkit `RouteTest` already has `header(name)`.
   
   ### Modification
   - Add `HttpMessage.header(headerName: String): Option[HttpHeader]` (`@since 
2.0.0`), matching the header name case-insensitively.
   - Make the `ClassTag` type argument explicit in javadsl 
`TestRouteResult.header`, so the call is not ambiguous with the new overload.
   
   ### Result
   `request.header("x-custom")` returns the first header with that name, 
regardless of case.
   
   ### Tests
   - `sbt "http-tests/Test/testOnly 
org.apache.pekko.http.scaladsl.server.ModeledCustomHeaderSpec"`: 6 passed on 
Scala 2.13 and 3.3.8
   - `sbt http-core/mimaReportBinaryIssues`: pass (`http-testkit` has MiMa 
disabled)
   - `scalafmt --mode diff-ref=upstream/main`: no changes
   
   ### References
   Port of akka/akka-http#4269 (Apache 2.0 now applies, since the Akka HTTP 
10.6.0 license change date of 2026-10-23). The extra `header("missing")` 
assertion is new.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to