Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set exact headers #79

Closed
plokhotnyuk opened this issue Feb 2, 2019 · 2 comments
Closed

Cannot set exact headers #79

plokhotnyuk opened this issue Feb 2, 2019 · 2 comments

Comments

@plokhotnyuk
Copy link

plokhotnyuk commented Feb 2, 2019

I need to set following headers:

< Server: youi
< Content-Type: application/json
< Content-Length: 27
< Date: Sat, 02 Feb 2019 13:11:50 GMT

But youi server sends a response with these headers:

< Connection: keep-alive
< Transfer-Encoding: chunked
< Date: Sat, 02 Feb 2019 13:14:17 GMT

How it can be coded for the most efficiency in runtime?
A branch with the sample code is here.

@darkfrog26
Copy link
Collaborator

Publishing 0.10.2 right now that will fix all of this. The 0.10 release introduced a bug that was keeping the content-type from being set automatically like it's supposed to.

In addition, if you want to set custom headers you can always do:

handlers += new HttpHandler {
      override def handle(connection: HttpConnection): Future[HttpConnection] = {
        Future.successful(connection.modify { response =>
          response.withHeader("Server", "youi")
        })
      }
    }

However, I've also introduced a Server header that defaults to "youi" as well, so this should all be resolved with 0.10.2 automatically.

@darkfrog26
Copy link
Collaborator

Okay, publish is complete. It's available on Sonatype, but it may take a while before it's synchronized to Maven Central.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants