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

Add support for CORS in http requests #738

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Kilowhisky
Copy link

@Kilowhisky Kilowhisky commented May 6, 2024

Please do not open a pull request without first filing an issue and/or discussing the feature directly with the project maintainer.

Please ensure you adhere to every item in this list

  • This PR was pre-approved by the project maintainer
  • I have self-reviewed the code
  • I have added all necessary tests

Describe your changes

Adds support for OPTIONS HTTP request and returns necessary headers to allow CORS to function properly

Issue number and link

#737

I'm not quite sure how testing should be performed here as I don't see any testing of the http interface right now.. maybe i'm missing something. Could use a pointer on where and how you'd like me to write tests.

Tests can be done with standard HTTP requests.

if _, err = wr.Write([]byte(corshead)); err != nil {
return false, err
}
return false, nil
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work if I return false or true. Not sure which is correct.

@Kilowhisky
Copy link
Author

Tests added

@Kilowhisky
Copy link
Author

Kilowhisky commented May 7, 2024

Verified against my test project in chrome. Request works successfully.

Screenshot 2024-05-06 at 10 12 56 PM Screenshot 2024-05-06 at 10 14 00 PM Screenshot 2024-05-06 at 10 14 50 PM

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.

None yet

1 participant