traforo 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -117,11 +117,18 @@ export class TunnelClient {
117
117
  headers: msg.headers,
118
118
  body: msg.method !== 'GET' && msg.method !== 'HEAD' ? body : undefined,
119
119
  });
120
- // Build response headers
120
+ // Build response headers, preserving multi-value Set-Cookie
121
121
  const resHeaders = {};
122
122
  res.headers.forEach((value, key) => {
123
+ if (key === 'set-cookie') {
124
+ return;
125
+ }
123
126
  resHeaders[key] = value;
124
127
  });
128
+ const cookies = res.headers.getSetCookie();
129
+ if (cookies.length > 0) {
130
+ resHeaders['set-cookie'] = cookies.length === 1 ? cookies[0] : cookies;
131
+ }
125
132
  // Check if we should stream the response
126
133
  const contentType = res.headers.get('content-type') || '';
127
134
  const transferEncoding = res.headers.get('transfer-encoding') || '';
package/dist/types.d.ts CHANGED
@@ -25,18 +25,19 @@ export type WsCloseMessage = {
25
25
  reason: string;
26
26
  };
27
27
  export type UpstreamMessage = HttpRequestMessage | WsOpenMessage | WsFrameMessage | WsCloseMessage;
28
+ export type ResponseHeaders = Record<string, string | string[]>;
28
29
  export type HttpResponseMessage = {
29
30
  type: 'http_response';
30
31
  id: string;
31
32
  status: number;
32
- headers: Record<string, string>;
33
+ headers: ResponseHeaders;
33
34
  body: string | null;
34
35
  };
35
36
  export type HttpResponseStartMessage = {
36
37
  type: 'http_response_start';
37
38
  id: string;
38
39
  status: number;
39
- headers: Record<string, string>;
40
+ headers: ResponseHeaders;
40
41
  };
41
42
  export type HttpResponseChunkMessage = {
42
43
  type: 'http_response_chunk';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traforo",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "HTTP tunnel via Cloudflare Durable Objects and WebSockets",
5
5
  "type": "module",
6
6
  "license": "MIT",