Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corsify override http error code. #233

Closed
AcidWeb opened this issue Apr 2, 2024 · 3 comments
Closed

Corsify override http error code. #233

AcidWeb opened this issue Apr 2, 2024 · 3 comments
Labels
BUG Something isn't working in progress I'm working on it... allegedly...

Comments

@AcidWeb
Copy link

AcidWeb commented Apr 2, 2024

Describe the Issue

I'm not sure if it's supposed to work that way, but enabling CORS change HTTP return code to always return 200.

Example Router Code

import { AutoRouter, cors, error } from 'itty-router'

const { preflight, corsify } = cors()

const router = AutoRouter({
  before: [preflight],
  finally: [corsify],
})

router.get('/', () => error(404))

export default { ...router }

Steps to Reproduce

  1. Run the code.
  2. Send request to /.
  3. Verify HTTP code of response.

Expected Behavior

Request should return 404.

Actual Behavior

Request return 200.

Environment:

  • Environment: Cloudflare Workers
  • itty-router version: v5.0.5
@kwhitley kwhitley added BUG Something isn't working in progress I'm working on it... allegedly... labels Apr 2, 2024
@kwhitley
Copy link
Owner

kwhitley commented Apr 2, 2024

Definitely not the intended behavior - thanks for catching that!

Starting the tests now~

@kwhitley
Copy link
Owner

kwhitley commented Apr 2, 2024

Confirmed, will have a fix out momentarily!

@kwhitley
Copy link
Owner

kwhitley commented Apr 2, 2024

Released as 5.0.6 just now :)

Thanks again for the catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working in progress I'm working on it... allegedly...
Projects
None yet
Development

No branches or pull requests

2 participants