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

   ### Motivation
   #1086 moved a dozen call sites to `Locale.ROOT` but landed without tests. On 
`main` today the only turkish-i coverage is the `HttpCharsets` case in 
`TurkishISpec`, and nothing exercises the two directives that were fixed, so a 
regression would only surface for users running with a turkish default locale.
   
   Two gaps worth calling out:
   
   - The obvious `Uri` test does not actually cover the fixed code. 
`Uri("IPP://example.com")` passes even against pre-#1086 code, because the 
string parser lowercases the scheme through the ASCII-only 
`CharUtils.toLowerCase` in `UriParser.appendLowered` and never reaches 
`Uri.normalizeScheme`. The test here uses `Uri(scheme = "IPP", authority = 
...)`, which does go through `normalizeScheme`.
   - `headerValueByName` and `overrideMethodWithParameter` live in the `http` 
module, so they need a spec outside `http-core`.
   
   ### Modification
   - `TurkishISpec` (http-core): four new cases under a `tr-TR` default locale 
covering `HttpHeader.parse`, `Uri` scheme normalization, 
`MediaTypes.forExtension` and `ErrorInfo.withErrorHeaderName`.
   - New `TurkishLocaleDirectivesSpec` (http-tests): covers 
`headerValueByName("If-Match")` and `overrideMethodWithParameter` with 
`_method=options` (`"options".toUpperCase` under `tr-TR` is `OPTİONS`, which 
used to yield `501 Not Implemented`).
   
   Both specs restore the previous default locale in a `finally`. Test-only 
change; no production code is touched.
   
   ### Result
   The paths #1086 fixed are pinned, and the same cases are available to check 
backports against.
   
   ### Tests
   - `sbt "http-core / Test / testOnly 
org.apache.pekko.http.scaladsl.model.TurkishISpec"` - 5 passed (JDK 21).
   - `sbt "http-tests / Test / testOnly 
org.apache.pekko.http.scaladsl.server.directives.TurkishLocaleDirectivesSpec"` 
- 2 passed. Both fail when `headerValueByName` and 
`overrideMethodWithParameter` are locally reverted to default-locale case 
conversion, so the cases are directional.
   - The four `TurkishISpec` cases likewise all fail against `1.4.x` without 
#1086 (verified while preparing the backport in #1224).
   - `sbt headerCreateAll` - added the standard Apache header to the new file.
   - `scalafmt --mode diff-ref=upstream/main` - clean.
   
   ### References
   Refs #1086, Refs #1224


-- 
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