In my akka-http application, I return a response from another security service responding with a WWW-Authenticate header: When akka-http parses that header and then displays the WWW-Authenticate value in a string, there are no quotation marks on one of the parameters. Am I missing something in the rendering, or could it be aka-http error?
Here's a test case:
import akka.http.scaladsl.model.HttpHeader import akka.http.scaladsl.model.HttpHeader.ParsingResult import akka.http.scaladsl.model.headers.{`WWW-Authenticate`, HttpChallenge} import org.scalatest.{Matchers, WordSpec} class wwwAuthenticateParserTest extends WordSpec with Matchers { "WWW-Authenticate header" should { "have correctly-quoted strings" in { val rawHeader = HttpHeader.parse("WWW-Authenticate", "Bearer error=\"invalid_request\", error_description=\"Access token is not found\"") val expectedHeader = `WWW-Authenticate`(HttpChallenge("Bearer", "", Map("error" -> "invalid_request", "error_description" -> "Access token is not found"))) rawHeader match { case ParsingResult.Ok(`WWW-Authenticate`(challenges), _) => challenges.head should be(expectedHeader.challenges.head) challenges.head.params("error") should be("invalid_request") challenges.head.toString should be("Bearer realm=\"\",error=\"invalid_request\",error_description=\"Access token is not found\"") case _ => ??? } }
The third test fails, and the quotes around invalid_request missing. Quotation marks are also missing in the response header that akka-http sends.
Joshg source share