Skip to content

Prevent CORS from blocking DELETE in mock-api server#360

Merged
Xemdo merged 1 commit intotwitchdev:mainfrom
jaretcantu:main
Mar 11, 2026
Merged

Prevent CORS from blocking DELETE in mock-api server#360
Xemdo merged 1 commit intotwitchdev:mainfrom
jaretcantu:main

Conversation

@jaretcantu
Copy link
Contributor

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Problem/Feature

The DELETE (and I assume PATCH and PUT) request methods are being blocked by CORS in the mock server:

Access to XMLHttpRequest at 'http://localhost:8080/mock/channel_points/custom_rewards?broadcaster_id=XXXX&id=XXXX'
from origin 'http://localhost' has been blocked by CORS policy:
Method DELETE is not allowed by Access-Control-Allow-Methods in preflight response.

Description of Changes:

  • Set the additional HTTP methods in a header in the mock-api server
  • This is the same Access-Control-Allow-Methods list from the websocket server (internal/events/websocket/mock_server/manager.go)

Checklist

  • My code follows the Contribution Guide
  • I have self-reviewed the changes being requested
  • I have made comments on pieces of code that may be difficult to understand for other editors
  • I have updated the documentation (if applicable)

The DELETE (and I assume PATCH and PUT) request methods are used
in the API, but these can run afoul of the Cross Origin Resource
Sharing policies.

Set the appropriate header to allow these methods in the mock
server.
@Xemdo Xemdo self-requested a review March 11, 2026 17:50
@Xemdo Xemdo merged commit fd7dac6 into twitchdev:main Mar 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants