Permalink
Browse files

Make SSE content type check tolerant of charset (#557)

Fixes #552
  • Loading branch information...
rhart authored and NiteshKant committed Sep 12, 2016
1 parent 9a1ebe8 commit 817aeeef6181f24ee439476d8e157dc0fd987a67
@@ -20,7 +20,6 @@
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.http.HttpResponse;
-import io.netty.handler.codec.http.HttpResponseDecoder;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpUtil;
import io.netty.handler.codec.http.HttpVersion;
@@ -255,7 +254,7 @@ public boolean isTransferEncodingChunked() {
@Override
public ContentSource<ServerSentEvent> getContentAsServerSentEvents() {
- if (containsHeader(CONTENT_TYPE, "text/event-stream", false)) {
+ if (containsHeader(CONTENT_TYPE) && getHeader(CONTENT_TYPE).startsWith("text/event-stream")) {
ChannelPipeline pipeline = unsafeNettyChannel().pipeline();
ChannelHandlerContext decoderCtx = pipeline.context(HttpHandlerNames.HttpClientCodec.getName());
if (null != decoderCtx) {

0 comments on commit 817aeee

Please sign in to comment.