elysia 1.4.10 → 1.4.11

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.
@@ -811,19 +811,18 @@ var handleSet = (set2) => {
811
811
  set2.headers[key]
812
812
  );
813
813
  let status2 = set2.status ?? 200;
814
- return response.status !== status2 && status2 !== 200 && (response.status <= 300 || response.status > 400) ? response.text().then((value) => {
815
- let newResponse = new Response(value, {
814
+ if (response.status !== status2 && status2 !== 200 && (response.status <= 300 || response.status > 400)) {
815
+ let newResponse = new Response(response.body, {
816
816
  headers: response.headers,
817
817
  status: set2.status
818
818
  });
819
- return !newResponse.headers.has("content-length") && newResponse.headers.get(
820
- "transfer-encoding"
821
- ) === "chunked" ? handleStream3(
819
+ return !newResponse.headers.has("content-length") && newResponse.headers.get("transfer-encoding") === "chunked" ? handleStream3(
822
820
  streamResponse(newResponse),
823
821
  responseToSetHeaders(newResponse, set2),
824
822
  request
825
823
  ) : newResponse;
826
- }) : !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream3(
824
+ }
825
+ return !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream3(
827
826
  streamResponse(response),
828
827
  responseToSetHeaders(response, set2),
829
828
  request
@@ -861,19 +861,18 @@ var handleSet = (set2) => {
861
861
  set2.headers[key]
862
862
  );
863
863
  let status2 = set2.status ?? 200;
864
- return response.status !== status2 && status2 !== 200 && (response.status <= 300 || response.status > 400) ? response.text().then((value) => {
865
- let newResponse = new Response(value, {
864
+ if (response.status !== status2 && status2 !== 200 && (response.status <= 300 || response.status > 400)) {
865
+ let newResponse = new Response(response.body, {
866
866
  headers: response.headers,
867
867
  status: set2.status
868
868
  });
869
- return !newResponse.headers.has("content-length") && newResponse.headers.get(
870
- "transfer-encoding"
871
- ) === "chunked" ? handleStream3(
869
+ return !newResponse.headers.has("content-length") && newResponse.headers.get("transfer-encoding") === "chunked" ? handleStream3(
872
870
  streamResponse(newResponse),
873
871
  responseToSetHeaders(newResponse, set2),
874
872
  request
875
873
  ) : newResponse;
876
- }) : !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream3(
874
+ }
875
+ return !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream3(
877
876
  streamResponse(response),
878
877
  responseToSetHeaders(response, set2),
879
878
  request
@@ -3937,11 +3936,11 @@ for(const [k,v] of c.request.headers.entries())c.headers[k]=v
3937
3936
  return _id || (_id = randomId());
3938
3937
  },
3939
3938
  validator: validateResponse,
3940
- ping(data) {
3941
- options.ping?.(data);
3939
+ ping(ws, data) {
3940
+ options.ping?.(ws, data);
3942
3941
  },
3943
- pong(data) {
3944
- options.pong?.(data);
3942
+ pong(ws, data) {
3943
+ options.pong?.(ws, data);
3945
3944
  },
3946
3945
  open: async (ws) => {
3947
3946
  try {
@@ -447,19 +447,18 @@ var handleSet = (set2) => {
447
447
  set2.headers[key]
448
448
  );
449
449
  let status = set2.status ?? 200;
450
- return response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400) ? response.text().then((value) => {
451
- let newResponse = new Response(value, {
450
+ if (response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400)) {
451
+ let newResponse = new Response(response.body, {
452
452
  headers: response.headers,
453
453
  status: set2.status
454
454
  });
455
- return !newResponse.headers.has("content-length") && newResponse.headers.get(
456
- "transfer-encoding"
457
- ) === "chunked" ? handleStream2(
455
+ return !newResponse.headers.has("content-length") && newResponse.headers.get("transfer-encoding") === "chunked" ? handleStream2(
458
456
  streamResponse(newResponse),
459
457
  responseToSetHeaders(newResponse, set2),
460
458
  request
461
459
  ) : newResponse;
462
- }) : !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream2(
460
+ }
461
+ return !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream2(
463
462
  streamResponse(response),
464
463
  responseToSetHeaders(response, set2),
465
464
  request
@@ -861,19 +861,18 @@ var handleSet = (set2) => {
861
861
  set2.headers[key]
862
862
  );
863
863
  let status2 = set2.status ?? 200;
864
- return response.status !== status2 && status2 !== 200 && (response.status <= 300 || response.status > 400) ? response.text().then((value) => {
865
- let newResponse = new Response(value, {
864
+ if (response.status !== status2 && status2 !== 200 && (response.status <= 300 || response.status > 400)) {
865
+ let newResponse = new Response(response.body, {
866
866
  headers: response.headers,
867
867
  status: set2.status
868
868
  });
869
- return !newResponse.headers.has("content-length") && newResponse.headers.get(
870
- "transfer-encoding"
871
- ) === "chunked" ? handleStream3(
869
+ return !newResponse.headers.has("content-length") && newResponse.headers.get("transfer-encoding") === "chunked" ? handleStream3(
872
870
  streamResponse(newResponse),
873
871
  responseToSetHeaders(newResponse, set2),
874
872
  request
875
873
  ) : newResponse;
876
- }) : !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream3(
874
+ }
875
+ return !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream3(
877
876
  streamResponse(response),
878
877
  responseToSetHeaders(response, set2),
879
878
  request
@@ -3954,11 +3953,11 @@ for(const [k,v] of c.request.headers.entries())c.headers[k]=v
3954
3953
  return _id || (_id = randomId());
3955
3954
  },
3956
3955
  validator: validateResponse,
3957
- ping(data) {
3958
- options.ping?.(data);
3956
+ ping(ws, data) {
3957
+ options.ping?.(ws, data);
3959
3958
  },
3960
- pong(data) {
3961
- options.pong?.(data);
3959
+ pong(ws, data) {
3960
+ options.pong?.(ws, data);
3962
3961
  },
3963
3962
  open: async (ws) => {
3964
3963
  try {
@@ -526,19 +526,18 @@ var handleSet = (set2) => {
526
526
  set2.headers[key]
527
527
  );
528
528
  let status = set2.status ?? 200;
529
- return response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400) ? response.text().then((value) => {
530
- let newResponse = new Response(value, {
529
+ if (response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400)) {
530
+ let newResponse = new Response(response.body, {
531
531
  headers: response.headers,
532
532
  status: set2.status
533
533
  });
534
- return !newResponse.headers.has("content-length") && newResponse.headers.get(
535
- "transfer-encoding"
536
- ) === "chunked" ? handleStream2(
534
+ return !newResponse.headers.has("content-length") && newResponse.headers.get("transfer-encoding") === "chunked" ? handleStream2(
537
535
  streamResponse(newResponse),
538
536
  responseToSetHeaders(newResponse, set2),
539
537
  request
540
538
  ) : newResponse;
541
- }) : !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream2(
539
+ }
540
+ return !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream2(
542
541
  streamResponse(response),
543
542
  responseToSetHeaders(response, set2),
544
543
  request
@@ -321,19 +321,18 @@ var handleSet = (set) => {
321
321
  set.headers[key]
322
322
  );
323
323
  let status = set.status ?? 200;
324
- return response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400) ? response.text().then((value) => {
325
- let newResponse = new Response(value, {
324
+ if (response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400)) {
325
+ let newResponse = new Response(response.body, {
326
326
  headers: response.headers,
327
327
  status: set.status
328
328
  });
329
- return !newResponse.headers.has("content-length") && newResponse.headers.get(
330
- "transfer-encoding"
331
- ) === "chunked" ? handleStream(
329
+ return !newResponse.headers.has("content-length") && newResponse.headers.get("transfer-encoding") === "chunked" ? handleStream(
332
330
  streamResponse(newResponse),
333
331
  responseToSetHeaders(newResponse, set),
334
332
  request
335
333
  ) : newResponse;
336
- }) : !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream(
334
+ }
335
+ return !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream(
337
336
  streamResponse(response),
338
337
  responseToSetHeaders(response, set),
339
338
  request
@@ -526,19 +526,18 @@ var handleSet = (set2) => {
526
526
  set2.headers[key]
527
527
  );
528
528
  let status = set2.status ?? 200;
529
- return response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400) ? response.text().then((value) => {
530
- let newResponse = new Response(value, {
529
+ if (response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400)) {
530
+ let newResponse = new Response(response.body, {
531
531
  headers: response.headers,
532
532
  status: set2.status
533
533
  });
534
- return !newResponse.headers.has("content-length") && newResponse.headers.get(
535
- "transfer-encoding"
536
- ) === "chunked" ? handleStream2(
534
+ return !newResponse.headers.has("content-length") && newResponse.headers.get("transfer-encoding") === "chunked" ? handleStream2(
537
535
  streamResponse(newResponse),
538
536
  responseToSetHeaders(newResponse, set2),
539
537
  request
540
538
  ) : newResponse;
541
- }) : !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream2(
539
+ }
540
+ return !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream2(
542
541
  streamResponse(response),
543
542
  responseToSetHeaders(response, set2),
544
543
  request
@@ -526,19 +526,18 @@ var handleSet = (set2) => {
526
526
  set2.headers[key]
527
527
  );
528
528
  let status = set2.status ?? 200;
529
- return response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400) ? response.text().then((value) => {
530
- let newResponse = new Response(value, {
529
+ if (response.status !== status && status !== 200 && (response.status <= 300 || response.status > 400)) {
530
+ let newResponse = new Response(response.body, {
531
531
  headers: response.headers,
532
532
  status: set2.status
533
533
  });
534
- return !newResponse.headers.has("content-length") && newResponse.headers.get(
535
- "transfer-encoding"
536
- ) === "chunked" ? handleStream2(
534
+ return !newResponse.headers.has("content-length") && newResponse.headers.get("transfer-encoding") === "chunked" ? handleStream2(
537
535
  streamResponse(newResponse),
538
536
  responseToSetHeaders(newResponse, set2),
539
537
  request
540
538
  ) : newResponse;
541
- }) : !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream2(
539
+ }
540
+ return !response.headers.has("content-length") && response.headers.get("transfer-encoding") === "chunked" ? handleStream2(
542
541
  streamResponse(response),
543
542
  responseToSetHeaders(response, set2),
544
543
  request