tsndr / cloudflare-worker-router

A super lightweight router (1.0K) with middleware support and ZERO dependencies for Cloudflare Workers.
MIT License
220 stars 30 forks source link

fixed cors response body #6

Closed luimu64 closed 2 years ago

luimu64 commented 2 years ago

Changes the default router.cors() to return null as body to prevent wrangler throwing error about non-null response body on every option request:

Constructing a Response with a null body status (204) and a non-null, zero-length body. This is technically incorrect, and we recommend you update your code to explicitly pass in a null body, e.g. new Response(null, { status: 204, ... }). (We continue to allow the zero-length body behavior because it was previously the only way to construct a Response with a null body status. This behavior may change in the future.)

tsndr commented 2 years ago

Thank you for your contribution, it's live with version 1.1.6 👍