akka/akka-http

Valid Content-Type header are eaten-up by headerValueByName directive

Open

#1,011 opened on Apr 4, 2017

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Scala (598 forks)batch import
1 - triagedhelp wantedt:docst:routing

Repository metrics

Stars
 (1,311 stars)
PR merge metrics
 (Avg merge 1d 10h) (2 merged PRs in 30d)

Description

It seems that HeaderValueByName, optinalHeaderValueByName and headerValueByType are not returning the content type if it is an valid one.

I posted already something on the mailing list https://groups.google.com/forum/#!topic/akka-user/ZClckCsc8e4

For testing purpose I wrote a small server (to test my client) object WebServer extends HttpApp { def route: Route = path("publishvalid") { optionalHeaderValueByName("Content-Type") { header => println("Content-Type is "+header) post { complete("") } } } }

While doing this I observed that the directive optionalHeaderValueByName was never returning a valid value if the Content-Type I send was valid (I used postman for it). If I used a customized Content-Type it works fine. Observed the same fore headerValueByName and HeaderContentType.

This seems like an bug for me, evenso it is mentioned here http://doc.akka.io/docs/akka-http/10.0.4/scala/http/common/http-model.html#http-model that the Content-Type is treated differntly.

Regards

Wolfgang

Contributor guide