Hello all,
I've decided to give akka-http a go. I have no experience with it or spray,
so I'm not quite sure if what I've found is a bug or not. I can't set the
content type with directives. Here's an example of things that compile and
things that don't, but I'd expect to. Any advice?
//this compiles, but it's not what I want to do, just similar
val route =
path("hello"){
get{
respondWithHeader(ETag("asdf")){
complete{
"{}"
}
}
}
}
// this does not compile
val route =
path("hello"){
get{
respondWithHeader(ContentType(MediaTypes.`text/html`)){
complete{
"{}"
}
}
}
}
[error]
/Users/dustinwhitney/Documents/development/september/app/modules/streams-test/src/main/scala/Main.scala:29:
type mismatch;
[error] found : akka.http.scaladsl.model.ContentType
[error] required: akka.http.scaladsl.model.HttpHeader
[error] respondWithHeader(ContentType(MediaTypes.`text/html`)){
[error]
// nor does this
val route =
path("hello"){
get{
respondWithHeader(`Content-Type`(MediaTypes.`text/html`)){
complete{
"{}"
}
}
}
}
[error]
/Users/dustinwhitney/Documents/development/september/app/modules/streams-test/src/main/scala/Main.scala:29:
constructor Content-Type in class Content-Type cannot be accessed in object
Main
[error] respondWithHeader(`Content-Type`(MediaTypes.`text/html`)){
[error] ^
[error] one error found
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.