!htp #19034 refactor content negotiation, upgrade to new MediaType / ContentType model

This commit is contained in:
Mathias 2015-12-01 23:07:56 +01:00
parent e9240b7d86
commit 899b92faf2
46 changed files with 652 additions and 403 deletions

View file

@ -150,7 +150,7 @@ class HttpServerExampleSpec extends WordSpec with Matchers {
.via(reactToConnectionFailure)
.map { request =>
// simple text "echo" response:
HttpResponse(entity = HttpEntity(ContentTypes.`text/plain`, request.entity.dataBytes))
HttpResponse(entity = HttpEntity(ContentTypes.`text/plain(UTF-8)`, request.entity.dataBytes))
}
serverSource
@ -173,7 +173,7 @@ class HttpServerExampleSpec extends WordSpec with Matchers {
val requestHandler: HttpRequest => HttpResponse = {
case HttpRequest(GET, Uri.Path("/"), _, _, _) =>
HttpResponse(entity = HttpEntity(MediaTypes.`text/html`,
HttpResponse(entity = HttpEntity(ContentTypes.`text/html(UTF-8)`,
"<html><body>Hello world!</body></html>"))
case HttpRequest(GET, Uri.Path("/ping"), _, _, _) =>
@ -207,7 +207,7 @@ class HttpServerExampleSpec extends WordSpec with Matchers {
val requestHandler: HttpRequest => HttpResponse = {
case HttpRequest(GET, Uri.Path("/"), _, _, _) =>
HttpResponse(entity = HttpEntity(MediaTypes.`text/html`,
HttpResponse(entity = HttpEntity(ContentTypes.`text/html(UTF-8)`,
"<html><body>Hello world!</body></html>"))
case HttpRequest(GET, Uri.Path("/ping"), _, _, _) =>