Skip to content

Commit 0c437a8

Browse files
Merge pull request #231 from Exlau/exlau/sse-cache-control-header-fix
fix: 🐛 can't establish sse when server side enable compress
2 parents 44839ee + e5eecd4 commit 0c437a8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/client/sse.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe("SSEClientTransport", () => {
2424
// Send SSE headers
2525
res.writeHead(200, {
2626
"Content-Type": "text/event-stream",
27-
"Cache-Control": "no-cache",
27+
"Cache-Control": "no-cache, no-transform",
2828
Connection: "keep-alive",
2929
});
3030

@@ -185,7 +185,7 @@ describe("SSEClientTransport", () => {
185185
if (req.method === "GET") {
186186
res.writeHead(200, {
187187
"Content-Type": "text/event-stream",
188-
"Cache-Control": "no-cache",
188+
"Cache-Control": "no-cache, no-transform",
189189
Connection: "keep-alive",
190190
});
191191
res.write("event: endpoint\n");
@@ -399,7 +399,7 @@ describe("SSEClientTransport", () => {
399399

400400
res.writeHead(200, {
401401
"Content-Type": "text/event-stream",
402-
"Cache-Control": "no-cache",
402+
"Cache-Control": "no-cache, no-transform",
403403
Connection: "keep-alive",
404404
});
405405
res.write("event: endpoint\n");
@@ -526,7 +526,7 @@ describe("SSEClientTransport", () => {
526526
if (auth === "Bearer new-token") {
527527
res.writeHead(200, {
528528
"Content-Type": "text/event-stream",
529-
"Cache-Control": "no-cache",
529+
"Cache-Control": "no-cache, no-transform",
530530
Connection: "keep-alive",
531531
});
532532
res.write("event: endpoint\n");
@@ -612,7 +612,7 @@ describe("SSEClientTransport", () => {
612612

613613
res.writeHead(200, {
614614
"Content-Type": "text/event-stream",
615-
"Cache-Control": "no-cache",
615+
"Cache-Control": "no-cache, no-transform",
616616
Connection: "keep-alive",
617617
});
618618
res.write("event: endpoint\n");

src/server/sse.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class SSEServerTransport implements Transport {
4444

4545
this.res.writeHead(200, {
4646
"Content-Type": "text/event-stream",
47-
"Cache-Control": "no-cache",
47+
"Cache-Control": "no-cache, no-transform",
4848
Connection: "keep-alive",
4949
});
5050

0 commit comments

Comments
 (0)