Skip to content

feat: implement multi header support#443

Merged
theseion merged 5 commits intocoreruleset:mainfrom
theseion:multi-headers
Jun 9, 2025
Merged

feat: implement multi header support#443
theseion merged 5 commits intocoreruleset:mainfrom
theseion:multi-headers

Conversation

@theseion
Copy link
Copy Markdown
Collaborator

  • support multiple headers with the same name

  • support multiple headers with identical name and value

  • make list of headers ordered; in the future, tests should be able to enforce the order of headers in a request

  • improve API, tests, and documentation of ftwhttp.Header

  • disable logging in tests where possible

  • enable self-updater test (go-critic was complaining because the test file was touched)

Fixes #332

@theseion theseion requested review from M4tteoP and fzipi January 12, 2025 11:25
@theseion
Copy link
Copy Markdown
Collaborator Author

Note that our test format currently does not support multiple headers with the same name, because we use a map for headers. In the future we should use a list instead in order to allow for repeating headers and values.

Copy link
Copy Markdown
Member

@fzipi fzipi left a comment

Choose a reason for hiding this comment

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

Thanks for taking this. Big change.

I'll suggest you to split in 3 PRs, as we are mixing stuff here.

  1. All the zerolog changes (🙏 good catch). E.g. inclusion and initialization.
func (s *responseTestSuite) SetupSuite() {
	zerolog.SetGlobalLevel(zerolog.Disabled)
}
  1. The uncommented self_updater tests
  2. This PR, rebased after the above.

It will make things more clear if we need to revert something.

Comment thread cmd/self_update_test.go
Comment thread ftwhttp/header.go Outdated
Comment thread ftwhttp/header.go Outdated
Comment thread ftwhttp/header.go Outdated
Comment thread ftwhttp/header_names/constants.go
Comment thread ftwhttp/header_test.go Outdated
Comment thread ftwhttp/header_values/constants.go Outdated
Comment thread ftwhttp/header_values/constants.go Outdated
Comment thread ftwhttp/request.go Outdated
Comment thread ftwhttp/request.go Outdated
@theseion theseion force-pushed the multi-headers branch 4 times, most recently from 411541d to d98119c Compare January 12, 2025 19:14
@theseion theseion requested a review from fzipi January 25, 2025 16:22
fzipi
fzipi previously approved these changes Feb 3, 2025
Copy link
Copy Markdown
Member

@fzipi fzipi left a comment

Choose a reason for hiding this comment

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

Looks like tests are broken?

Comment thread test/data_test.go Outdated
Comment thread test/data_test.go Outdated
Comment thread test/data_test.go Outdated
Comment thread test/data_test.go Outdated
Comment thread test/data_test.go Outdated
Comment thread test/data_test.go Outdated
Comment thread test/data_test.go Outdated
@theseion theseion requested a review from fzipi February 5, 2025 06:05
fzipi
fzipi previously approved these changes Feb 14, 2025
@theseion
Copy link
Copy Markdown
Collaborator Author

Extended PR with updated schema and support for new ordered_headers field.

theseion added 5 commits May 17, 2025 15:01
- support multiple headers with the same name
- support multiple headers with identical name and value
- make list of headers ordered; in the future, tests should be able to
  enforce the order of headers in a request
- improve API, tests, and documentation of ftwhttp.Header

- disable logging in tests where possible
- enable self-updater test (go-critic was complaining because the test
  file was touched)

Fixes coreruleset#332
@theseion
Copy link
Copy Markdown
Collaborator Author

Please review @fzipi @M4tteoP

@theseion
Copy link
Copy Markdown
Collaborator Author

theseion commented Jun 6, 2025

Please review @fzipi @M4tteoP

Copy link
Copy Markdown
Member

@fzipi fzipi left a comment

Choose a reason for hiding this comment

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

LGTM. I see a missed opportunity for pineapple and pizza vs. homer & donuts 😄 😄

@theseion theseion merged commit 9f994c3 into coreruleset:main Jun 9, 2025
4 checks passed
@theseion theseion deleted the multi-headers branch June 9, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement multi-value headers

2 participants