extractParserSettings
Description
Extracts the request’s underlying ParserSettings
ParserSettings
, which can be useful when you want to access custom status codes and media types.
Example
- Scala
-
source
val route = extractParserSettings { parserSettings => complete(s"URI parsing mode is ${parserSettings.uriParsingMode}") } // tests: Get("/") ~> route ~> check { responseAs[String] shouldEqual "URI parsing mode is Strict" }
- Java
-
source
import static akka.http.javadsl.server.Directives.extractParserSettings; final Route route = extractParserSettings(parserSettings -> complete("URI parsing mode is " + parserSettings.getUriParsingMode()) ); // tests: testRoute(route).run(HttpRequest.GET("/")) .assertEntity("URI parsing mode is Strict");