feat(http): add cors flags#372
Merged
adrienaury merged 6 commits intoJun 6, 2025
Merged
Conversation
youen
marked this pull request as draft
June 4, 2025 06:40
youen
marked this pull request as ready for review
June 4, 2025 07:02
adrienaury
requested changes
Jun 4, 2025
There was a problem hiding this comment.
Pull Request Overview
Adds configurable CORS support to the lino http sub-command, allowing users to enable CORS and specify allowed origins, methods, and headers.
- Introduce
--enable-cors,--cors-origins,--cors-methods, and--cors-headersflags and wrap the HTTP handler in CORS middleware when enabled - Add
github.com/rs/corsdependency ingo.mod - Document the new flags in
README.mdand record the feature inCHANGELOG.md
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/app/http/cli.go | Added CORS flags and conditional middleware wrap |
| go.mod | Added github.com/rs/cors dependency |
| README.md | Documented HTTP sub-command and CORS configuration |
| CHANGELOG.md | Logged new CORS feature under version 3.3.0 |
Comments suppressed due to low confidence (3)
internal/app/http/cli.go:76
- New CORS logic is introduced but no tests have been added to verify CORS headers. Consider adding unit or integration tests to confirm proper CORS responses when enabled.
if enableCORS {
README.md:607
- Duplicate "### CORS Configuration" heading found on lines 603 and 607; remove the redundant section to avoid confusion.
### CORS Configuration
internal/app/http/cli.go:77
- [nitpick] The variable name
cis ambiguous; consider renaming it tocorsHandlerorcorsMiddlewarefor improved clarity.
c := cors.New(cors.Options{
adrienaury
approved these changes
Jun 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.