Comments (10)
So this currently isn't possible without digging down into the guts and changing the definition of SSE. Looking at it, I think it is probably required. What you can do is to change the SSE handler at the server level (but that isn't a great solution TBH)
from http4k.
We've got an idea, and looking at what to do to make sure it's testable. It's going to be a breaking change whatever happens if we want to support it. For the time being, if you need to rewrite the underlying server-level handler that's the only way. Stay tuned :)
from http4k.
@daviddenton Thank you for the fast response.
What does it mean to rewrite the underlying server-level handler, exactly?
from http4k.
Well, assuming you are using Jetty, it would involve creating your own version of the server-backend and explicitly: JettyEventStreamHandler
. This is pretty horrid TBH and would only work if you really want to set a standard set of headers for every SSE request
from http4k.
We think we have an idea of the type of change that might be required - we'll keep you posted
from http4k.
@daviddenton Then I'll stay put for now :)
from http4k.
We've managed to fix this and are releasing the changes as a part of 5.1.0.0 :)
from http4k.
@daviddenton Great, thanks! :)
from http4k.
@daviddenton Hi! I thought this was solved but when I'm trying to create a CORS-filter with the SseFilter
I'm not allowed to set any headers for the response, ref:
val corsFilter = SseFilter { next ->
{ request ->
val response = next(request)
response.header("Access-Control-Allow-Origin", "*") <-- the .header method does not exist
response
}
}
Let me know If I'm missing something.
from http4k.
@daviddenton Ah nevermind I forgot about the copy
method, ref:
response.copy(headers = listOf("Access-Control-Allow-Origin" to "*"))
from http4k.
Related Issues (20)
- Use RequestContexts for providing a User Principal with org.http4k.contract.security.Security HOT 1
- Integrate Jackson Module Kogera HOT 5
- Extracting access token from custom AccessToken response fails HOT 2
- Remove all extraneous options for server creation
- Jackson does not honour serialisation of Enums when they are used as Map keys HOT 1
- Support multi value query parameters in ApiGatewayV2LambdaFunction (http4k-serverless/lambda)
- Documentation error? - Lambda version HOT 2
- For a request with matching if-none-match header the response lacks the etag header HOT 1
- Header values in quotes lose their quotes HOT 2
- Client code works with OkHttp, fails with Java HTTP HOT 1
- Maven POM for http4k-format-jackson-xml is invalid: jackson-dataformat-xml is missing a version HOT 1
- Deserialisation exception from GraphQLResponse.from
- OpenApi 3 schema generation is flawed for Maps HOT 5
- Java8HttpClient causes SignatureDoesNotMatch exception on S3Bucket.copyObject() request HOT 11
- Support WsHandler symmetry HOT 1
- Http4kWebDriver does not work on Windows due to path issues. HOT 3
- Add BiDiLensSpec defaulted with factory method HOT 5
- Error when parsing AWS lambda event from S3 bucket HOT 3
- Can't define the file download spec in OpenAPI HOT 3
- brew tap should not install jdk when I already have it HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http4k.