Repository navigation
refactor!: Remove unused strict flag - #181
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughRemoves the strictHeaders configuration from RelicServer and serve(). Tests and helpers are updated to a validation vs without-validation framing, introducing lazy/on-demand header validation documented via HeaderValidationDocs. Test utilities drop the strictHeaders argument, and all tests now use createServer() without flags. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant S as RelicServer
participant H as Header Store
participant P as Header Parser
Note over S,H: Lazy header validation model
C->>S: HTTP Request
S->>H: Capture raw headers
alt With validation (handler accesses headers)
S->>H: touchHeaders((h) => use h.X)
H->>P: Parse/validate header X
alt Valid
P-->>H: Parsed value
H-->>S: Provide value to handler
S-->>C: Response
else Invalid/Empty
P-->>S: Throw BadRequest (validation path)
S-->>C: 400 Bad Request
end
else Without validation (no access)
Note over S: Handler never reads headers
S-->>C: Response (no header validation performed)
end
rect rgba(230,245,255,0.5)
Note right of P: New/changed: validation occurs only when accessed via touchHeaders
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #181 +/- ##
=======================================
Coverage 91.76% 91.76%
=======================================
Files 85 85
Lines 3122 3122
Branches 1618 1618
=======================================
Hits 2865 2865
Misses 257 257 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8404e53 to
0c13d96
Compare
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
test/headers/typed/if_match_header_test.dart (1)
71-72: Fix malformed ETag in wildcard test to avoid false negatives.The current value has an unmatched quote; ensure the failure reason is “wildcard with other values,” not a quoting error.
- headers: {'if-match': '*, 123456"'}, + headers: {'if-match': '*, "123456"'},test/headers/typed/if_none_match_header_test.dart (1)
71-72: Fix unmatched quote in wildcard test input.Same issue as If-Match; keep the test focused on the wildcard rule.
- headers: {'if-none-match': '*, 123456"'}, + headers: {'if-none-match': '*, "123456"'},test/headers/typed/cache_control_header_test.dart (1)
129-142: Test intent vs setup mismatch: headers map is emptyThe test description says an invalid Cache-Control value is provided, but you pass an empty headers map, weakening coverage.
Apply:
- final headers = await getServerRequestHeaders( - server: server, - touchHeaders: (final _) {}, - headers: {}, - ); + final headers = await getServerRequestHeaders( + server: server, + touchHeaders: (final _) {}, + headers: {'cache-control': 'invalid-directive'}, + );
♻️ Duplicate comments (7)
test/headers/basic/location_header_test.dart (1)
8-8: Inconsistent documentation reference.Same issue as the previous file - the comment references
HeaderValidationDocsbut imports fromstrict_validation_docs.dart.test/headers/typed/if_range_header_test.dart (1)
9-9: Inconsistent documentation reference.Same documentation import/reference inconsistency as other files.
test/headers/basic/allow_header_test.dart (1)
8-8: Inconsistent documentation reference.Same documentation import/reference inconsistency as other files.
test/headers/typed/proxy_authorization_header_test.dart (1)
10-10: Inconsistent documentation reference.Same documentation import/reference inconsistency as other files.
test/headers/basic/trailer_header_test.dart (1)
8-8: Inconsistent documentation reference.Same documentation import/reference inconsistency as other files.
test/headers/basic/date_header_test.dart (1)
9-9: Inconsistent documentation reference.Same documentation import/reference inconsistency as other files.
test/headers/typed/access_control_request_method_header_test.dart (1)
8-8: Inconsistent documentation reference.Same documentation import/reference inconsistency as other files.
🧹 Nitpick comments (32)
lib/src/relic_server.dart (1)
111-116: Use UTC for HTTP Date headerHTTP Date should be IMF-fixdate (GMT). Set UTC explicitly.
Apply:
- mh.date ??= DateTime.now(); + mh.date ??= DateTime.now().toUtc();lib/src/adapter/io/io_serve.dart (1)
19-26: Optional: keep a deprecated no-op named parameter to ease migrationIf you want a softer break, accept (and ignore) the old flag for one release.
Example:
Future<RelicServer> serve( Handler handler, InternetAddress address, int port, { @Deprecated('Removed. Header validation is on-demand; this flag is ignored.') bool? strictHeaders, SecurityContext? securityContext, int? backlog, bool shared = false, }) async { // ignore: unused_local_variable final _ = strictHeaders; // ... }test/headers/basic/access_control_max_age_header_test.dart (1)
8-9: Docs and setup updated — OKMinor copy note (not blocking): consider “an invalid” in test title(s).
Also applies to: 11-12, 16-17
test/headers/basic/if_modified_since_header_test.dart (1)
5-5: Consider renaming the docs import to match the new class.If the file was renamed, update the import for clarity.
-import '../docs/strict_validation_docs.dart'; +import '../docs/header_validation_docs.dart';test/headers/typed/expect_header_test.dart (1)
61-64: Tighten test description grammar.Use singular “header” to avoid confusion.
- 'then the server does not respond with a bad request if the headers ' - 'is not actually used', + 'then the server does not respond with a bad request if the header ' + 'is not actually used',test/headers/basic/if_unmodified_since_header_test.dart (1)
67-70: Clarify description wording.Minor grammar fix for readability.
- 'then the server does not respond with a bad request if the headers ' - 'is not actually used', + 'then the server does not respond with a bad request if the header ' + 'is not actually used',test/headers/typed/content_disposition_header_test.dart (1)
90-121: Add a test for RFC 5987 filename to cover i18n filenames.*Covers common real-world cases with UTF-8 and percent-encoding.
+ test( + 'when a Content-Disposition header uses RFC 5987 filename* then it should parse correctly', + () async { + final headers = await getServerRequestHeaders( + server: server, + touchHeaders: (final h) => h.contentDisposition, + headers: { + 'content-disposition': + "attachment; filename*=UTF-8''caf%C3%A9.png" + }, + ); + + expect(headers.contentDisposition?.type, equals('attachment')); + expect( + headers.contentDisposition?.parameters.any( + (p) => p.name == 'filename*' && p.value == "UTF-8''caf%C3%A9.png", + ), + isTrue, + ); + }, + );test/headers/typed/te_header_test.dart (1)
165-176: Fix typo: “quantities” → “qualities”.These are q values (qualities), not quantities.
- 'with quantities then they should parse the encodings correctly', + 'with qualities then they should parse the encodings correctly',test/headers/typed/content_range_header_test.dart (1)
108-115: Polish description grammar.Singular “header” reads better.
- 'then the server does not respond with a bad request if the headers ' - 'is not actually used', + 'then the server does not respond with a bad request if the header ' + 'is not actually used',test/headers/typed/sec_fetch_site_header_test.dart (3)
58-61: Fix wording: “headers is” → “header is”Minor grammar nit in the test description.
- 'then the server does not respond with a bad request if the headers ' - 'is not actually used', + 'then the server does not respond with a bad request if the header ' + 'is not actually used',
107-119: “empty header” test actually omits the header; assert the empty-value pathMake this consistent with other “without validation” tests by sending an empty value and asserting valueOrNullIfInvalid plus the typed accessor throwing.
- group('When an empty Sec-Fetch-Site header is passed', () { + group('When an empty Sec-Fetch-Site header is passed', () { test( 'then it should return null', () async { - final headers = await getServerRequestHeaders( + final headers = await getServerRequestHeaders( server: server, touchHeaders: (final _) {}, - headers: {}, + headers: {'sec-fetch-site': ''}, ); - - expect(headers.secFetchSite, isNull); + expect(Headers.secFetchSite[headers].valueOrNullIfInvalid, isNull); + expect(() => headers.secFetchSite, throwsInvalidHeader); }, ); });
4-4: Optional: rename file to match classThe import path still says strict_validation_docs.dart while the class is HeaderValidationDocs. Consider renaming the file to header_validation_docs.dart for clarity and updating imports.
test/headers/typed/accept_ranges_header_test.dart (2)
38-41: Fix wording: “headers is” → “header is”- 'then the server does not respond with a bad request if the headers ' - 'is not actually used', + 'then the server does not respond with a bad request if the header ' + 'is not actually used',
68-79: Nit: article agreementUse “an Accept-Ranges header”.
- 'when a Accept-Ranges header with "none" is passed then it should parse correctly', + 'when an Accept-Ranges header with "none" is passed then it should parse correctly',test/headers/docs/strict_validation_docs.dart (1)
1-15: Doc accurately explains validation-on-use behaviorReads well and matches test semantics. Consider renaming the file to header_validation_docs.dart to align name and content.
test/headers/typed/cross_origin_opener_policy_header_test.dart (2)
58-61: Fix wording: “headers is” → “header is”- 'then the server does not respond with a bad request if the headers ' - 'is not actually used', + 'then the server does not respond with a bad request if the header ' + 'is not actually used',
107-117: “empty header” test actually omits the header; assert the empty-value pathMirror the pattern used in other files for consistency.
- group('When an empty Cross-Origin-Opener-Policy header is passed', () { + group('When an empty Cross-Origin-Opener-Policy header is passed', () { test( 'then it should return null', () async { final headers = await getServerRequestHeaders( server: server, touchHeaders: (final _) {}, - headers: {}, + headers: {'cross-origin-opener-policy': ''}, ); - expect(headers.crossOriginOpenerPolicy, isNull); + expect( + Headers.crossOriginOpenerPolicy[headers].valueOrNullIfInvalid, + isNull, + ); + expect(() => headers.crossOriginOpenerPolicy, throwsInvalidHeader); }, ); });test/headers/typed/transfer_encoding_header_test.dart (2)
59-63: Fix wording: “headers is” → “header is”- 'then the server does not respond with a bad request if the headers ' - 'is not actually used', + 'then the server does not respond with a bad request if the header ' + 'is not actually used',
93-96: Typo in test description: “sot” → “so that”- 'encoding then it should parse the encodings correctly and reorder them sot the ' + 'encoding then it should parse the encodings correctly and reorder them so that the 'test/headers/basic/access_control_request_headers_header_test.dart (1)
44-47: Fix wording: “headers is” → “header is”- 'passed then the server does not respond with a bad request if the ' - 'headers is not actually used', + 'passed then the server does not respond with a bad request if the ' + 'header is not actually used',test/headers/typed/www_authenticate_header_test.dart (2)
19-33: Test name mentions FormatException but assertion expects BadRequestExceptionAlign the description with the assertion.
- 'when an empty WWW-Authenticate header is passed then it should throw FormatException', + 'when an empty WWW-Authenticate header is passed then it should throw BadRequestException',
38-41: Fix wording: “headers is” → “header is”- 'then the server does not respond with a bad request if the headers ' - 'is not actually used', + 'then the server does not respond with a bad request if the header ' + 'is not actually used',test/headers/basic/content_location_header_test.dart (1)
8-8: Docs reference rename looks good; consider aligning file name.Comment now points to HeaderValidationDocs. Optional: rename/import
../docs/header_validation_docs.dartto match the class for consistency.test/headers/typed/sec_fetch_mode_header_test.dart (2)
98-104: Add a null-on-invalid case in the “without validation” suite (optional).For symmetry with other headers, add a test that sends an invalid value without touching the typed accessor and asserts valueOrNullIfInvalid is null, plus that typed access throws.
107-118: Fix mismatch: test says “empty header” but header map omits the header.Either rename the test to “When no Sec-Fetch-Mode header is passed” (minimal) or send an empty value and assert valueOrNullIfInvalid.
Apply this minimal diff to fix the title:
- group('When an empty Sec-Fetch-Mode header is passed', () { + group('When no Sec-Fetch-Mode header is passed', () {test/headers/typed/access_control_allow_methods_header_test.dart (1)
147-156: Title says “empty header” but the header is missing.Align the description or payload. Minimal fix: rename to “no … header is passed”.
- group('when an empty Access-Control-Allow-Methods header is passed', () { + group('when no Access-Control-Allow-Methods header is passed', () {test/headers/typed/access_control_allow_headers_header_test.dart (1)
130-138: Title says “empty header” but the header is missing.Rename for accuracy, or send an empty value and assert valueOrNullIfInvalid.
- group('when an empty Access-Control-Allow-Headers header is passed', () { + group('when no Access-Control-Allow-Headers header is passed', () {test/headers/typed/strict_transport_security_header_test.dart (1)
157-157: Clarify group title to reflect lazy validation trigger“Without validation” here means “header not accessed, so validation not triggered.” Consider renaming for precision.
-group('Given a Strict-Transport-Security header without validation', () { +group('Given a Strict-Transport-Security header (not accessed; no validation)', () {test/headers/typed/cache_control_header_test.dart (1)
329-329: Nit: clarify “without validation” wordingConsider explicitly indicating that validation isn’t triggered because the header isn’t accessed.
-group('Given a Cache-Control header without validation', () { +group('Given a Cache-Control header (not accessed; no validation)', () {test/headers/typed/from_header_test.dart (1)
196-196: Nit: clarify “without validation”Make the group title explicit about not touching the header so validation isn’t triggered.
-group('Given a From header without validation', () { +group('Given a From header (not accessed; no validation)', () {test/headers/typed/content_security_policy_header_test.dart (1)
110-110: Nit: clarify “without validation”Suggest clearer wording about not accessing the header.
-group('Given a Content-Security-Policy header without validation', () { +group('Given a Content-Security-Policy header (not accessed; no validation)', () {test/headers/basic/access_control_allow_credentials_header_test.dart (1)
24-27: Nit: clarify non-validation semantics in group titleWording could better reflect that validation isn’t triggered unless the header is accessed.
-group( - 'Given an Access-Control-Allow-Credentials header without validation', +group( + 'Given an Access-Control-Allow-Credentials header (not accessed; no validation)',Also applies to: 136-156
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (69)
lib/src/adapter/io/io_serve.dart(1 hunks)lib/src/relic_server.dart(1 hunks)test/headers/basic/access_control_allow_credentials_header_test.dart(2 hunks)test/headers/basic/access_control_max_age_header_test.dart(1 hunks)test/headers/basic/access_control_request_headers_header_test.dart(2 hunks)test/headers/basic/age_header_test.dart(2 hunks)test/headers/basic/allow_header_test.dart(2 hunks)test/headers/basic/content_location_header_test.dart(2 hunks)test/headers/basic/date_header_test.dart(2 hunks)test/headers/basic/expires_header_test.dart(2 hunks)test/headers/basic/if_modified_since_header_test.dart(2 hunks)test/headers/basic/if_unmodified_since_header_test.dart(2 hunks)test/headers/basic/last_modified_header.dart(2 hunks)test/headers/basic/location_header_test.dart(2 hunks)test/headers/basic/max_forwards_header_test.dart(2 hunks)test/headers/basic/origin_header_test.dart(2 hunks)test/headers/basic/referer_header_test.dart(2 hunks)test/headers/basic/server_header_test.dart(2 hunks)test/headers/basic/trailer_header_test.dart(2 hunks)test/headers/basic/user_agent_header_test.dart(2 hunks)test/headers/basic/via_header_test.dart(2 hunks)test/headers/basic/x_powered_by_header_test.dart(1 hunks)test/headers/docs/strict_validation_docs.dart(1 hunks)test/headers/headers_test_utils.dart(1 hunks)test/headers/typed/accept_encoding_header_test.dart(2 hunks)test/headers/typed/accept_header_test.dart(2 hunks)test/headers/typed/accept_language_test.dart(2 hunks)test/headers/typed/accept_ranges_header_test.dart(2 hunks)test/headers/typed/access_control_allow_headers_header_test.dart(2 hunks)test/headers/typed/access_control_allow_methods_header_test.dart(2 hunks)test/headers/typed/access_control_allow_origin_header_test.dart(2 hunks)test/headers/typed/access_control_expose_headers_header_test.dart(2 hunks)test/headers/typed/access_control_request_method_header_test.dart(2 hunks)test/headers/typed/authorization_header_test.dart(2 hunks)test/headers/typed/cache_control_header_test.dart(2 hunks)test/headers/typed/clear_site_data_header_test.dart(2 hunks)test/headers/typed/connection_header_test.dart(2 hunks)test/headers/typed/content_disposition_header_test.dart(2 hunks)test/headers/typed/content_encoding_header_test.dart(2 hunks)test/headers/typed/content_language_header_test.dart(2 hunks)test/headers/typed/content_range_header_test.dart(2 hunks)test/headers/typed/content_security_policy_header_test.dart(2 hunks)test/headers/typed/cookie_header_test.dart(2 hunks)test/headers/typed/cross_origin_embedder_policy_header_test.dart(2 hunks)test/headers/typed/cross_origin_opener_policy_header_test.dart(2 hunks)test/headers/typed/cross_origin_resource_policy_header_test.dart(2 hunks)test/headers/typed/etag_header_test.dart(2 hunks)test/headers/typed/expect_header_test.dart(2 hunks)test/headers/typed/from_header_test.dart(2 hunks)test/headers/typed/if_match_header_test.dart(2 hunks)test/headers/typed/if_none_match_header_test.dart(2 hunks)test/headers/typed/if_range_header_test.dart(2 hunks)test/headers/typed/permissions_policy_header_test.dart(2 hunks)test/headers/typed/proxy_authenticate_header_test.dart(2 hunks)test/headers/typed/proxy_authorization_header_test.dart(2 hunks)test/headers/typed/range_header_test.dart(2 hunks)test/headers/typed/referrer_policy_header_test.dart(2 hunks)test/headers/typed/retry_after_header_test.dart(2 hunks)test/headers/typed/sec_fetch_dest_header_test.dart(2 hunks)test/headers/typed/sec_fetch_mode_header_test.dart(2 hunks)test/headers/typed/sec_fetch_site_header_test.dart(2 hunks)test/headers/typed/set_cookie_header_test.dart(2 hunks)test/headers/typed/strict_transport_security_header_test.dart(2 hunks)test/headers/typed/te_header_test.dart(2 hunks)test/headers/typed/transfer_encoding_header_test.dart(2 hunks)test/headers/typed/upgrade_header_test.dart(1 hunks)test/headers/typed/vary_header_test.dart(2 hunks)test/headers/typed/www_authenticate_header_test.dart(2 hunks)test/relic_server_test.dart(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-05T08:47:42.534Z
Learnt from: nielsenko
PR: serverpod/relic#146
File: lib/src/headers/typed/headers/forwarded_header.dart:185-187
Timestamp: 2025-09-05T08:47:42.534Z
Learning: In ForwardedHeader class in lib/src/headers/typed/headers/forwarded_header.dart, nielsenko prefers to keep constructor validation minimal (only checking elements.isNotEmpty) rather than validating individual ForwardedElement contents, stating "ForwardedHeader maintains its own integrity".
Applied to files:
test/headers/basic/max_forwards_header_test.darttest/headers/typed/access_control_request_method_header_test.darttest/headers/typed/access_control_allow_origin_header_test.dart
🔇 Additional comments (133)
lib/src/adapter/io/io_serve.dart (1)
34-36: serve() no longer forwards strictHeaders — OKChange aligns with constructor update. No functional issues spotted.
test/relic_server_test.dart (1)
15-16: createServer() without strict flag — OKSetup matches the new API; tests remain clear.
test/headers/basic/origin_header_test.dart (1)
8-9: Terminology and setup updated — OKSwitch to “validation/without validation” and parameterless createServer() reads well and reflects on-demand validation.
Also applies to: 11-12, 16-16, 165-165, 169-169
test/headers/typed/upgrade_header_test.dart (1)
8-9: Tests aligned to validation semantics — OKNo issues; behavior matches new default.
Also applies to: 10-10, 14-15
test/headers/typed/cross_origin_embedder_policy_header_test.dart (1)
8-9: Validation/without-validation grouping and setup — OKConsistent with the new approach; no issues.
Also applies to: 11-12, 16-17, 105-106, 110-111
test/headers/basic/x_powered_by_header_test.dart (1)
7-7: Doc link verified — HeaderValidationDocs is definedHeaderValidationDocs is declared at test/headers/docs/strict_validation_docs.dart:15; no change needed.
test/headers/typed/expect_header_test.dart (1)
8-15: Validation-based grouping and server bootstrap look good.Matches the removal of strictHeaders and the new validation semantics.
Also applies to: 92-97
test/headers/basic/if_unmodified_since_header_test.dart (1)
9-18: Docs reference and createServer() changes LGTM.Consistent with API cleanup and on-demand validation.
Also applies to: 129-134
test/headers/typed/if_match_header_test.dart (1)
8-15: Adoption of validation semantics looks correct.Group titles and setup align with the strict flag removal.
Also applies to: 215-220
test/headers/typed/if_none_match_header_test.dart (1)
8-15: Validation mode + helper usage LGTM.Matches the new on-demand validation behavior.
Also applies to: 215-220
test/headers/typed/content_disposition_header_test.dart (1)
8-15: Docs reference and server init updates look good.Tests reflect the lazy/validated access pattern post-refactor.
Also applies to: 136-141
test/headers/typed/te_header_test.dart (1)
8-15: Switch to validation semantics and parameterless server creation LGTM.No issues spotted in the core changes.
Also applies to: 214-219
test/headers/typed/content_range_header_test.dart (1)
8-15: Docs link and server setup changes look correct.Test intent remains unchanged; aligns with strict flag removal.
Also applies to: 187-192
test/headers/basic/if_modified_since_header_test.dart (1)
9-16: Rename and server setup change LGTM — verified.
HeaderValidationDocs exists; throwsInvalidHeader matcher exists. No tests pass strictHeaders; the only remaining mention is the Request.fromHttpRequest parameter in lib/src/adapter/io/request.dart.test/headers/typed/cross_origin_resource_policy_header_test.dart (3)
8-8: LGTM! Documentation reference correctly updated.The documentation reference has been appropriately updated from
StrictValidationDocstoHeaderValidationDocs, aligning with the broader refactoring effort.
11-11: Consistent test group naming reflects new validation approach.The test group descriptions have been appropriately updated from strict flag terminology to validation-based terminology, maintaining clear distinction between validation and non-validation scenarios.
Also applies to: 105-105
16-16: Server creation properly simplified to default configuration.Both test groups now use the parameterless
createServer()method, correctly reflecting the removal of thestrictHeadersparameter from the API.Also applies to: 110-110
test/headers/basic/server_header_test.dart (3)
8-8: LGTM! Documentation reference correctly updated.The documentation reference has been appropriately updated from
StrictValidationDocstoHeaderValidationDocs.
11-11: Consistent test group naming reflects new validation approach.The test group descriptions have been appropriately updated to use validation-based terminology instead of strict flag terminology.
Also applies to: 99-99
16-16: Server creation properly simplified to default configuration.Both test groups now use the parameterless
createServer()method, correctly reflecting the removal of thestrictHeadersparameter.Also applies to: 103-103
test/headers/basic/referer_header_test.dart (3)
8-8: LGTM! Documentation reference correctly updated.The documentation reference has been appropriately updated from
StrictValidationDocstoHeaderValidationDocs.
11-11: Consistent test group naming reflects new validation approach.The test group descriptions have been appropriately updated to use validation-based terminology.
Also applies to: 163-163
16-16: Server creation properly simplified to default configuration.Both test groups now use the parameterless
createServer()method, correctly reflecting the API changes.Also applies to: 167-167
test/headers/typed/etag_header_test.dart (3)
8-8: LGTM! Documentation reference correctly updated.The documentation reference has been appropriately updated from
StrictValidationDocstoHeaderValidationDocs.
10-10: Consistent test group naming reflects new validation approach.The test group descriptions have been appropriately updated to use validation-based terminology.
Also applies to: 119-119
14-14: Server creation properly simplified to default configuration.Both test groups now use the parameterless
createServer()method, correctly reflecting the API changes.Also applies to: 123-123
test/headers/typed/accept_encoding_header_test.dart (3)
8-8: LGTM! Documentation reference correctly updated.The documentation reference has been appropriately updated from
StrictValidationDocstoHeaderValidationDocs.
10-10: Consistent test group naming reflects new validation approach.The test group descriptions have been appropriately updated to use validation-based terminology.
Also applies to: 354-354
14-14: Server creation properly simplified to default configuration.Both test groups now use the parameterless
createServer()method, correctly reflecting the API changes.Also applies to: 358-358
test/headers/typed/connection_header_test.dart (3)
8-8: LGTM! Documentation reference correctly updated.The documentation reference has been appropriately updated from
StrictValidationDocstoHeaderValidationDocs.
10-10: Consistent test group naming reflects new validation approach.The test group descriptions have been appropriately updated to use validation-based terminology.
Also applies to: 138-138
14-14: Server creation properly simplified to default configuration.Both test groups now use the parameterless
createServer()method, correctly reflecting the API changes.Also applies to: 142-142
test/headers/basic/user_agent_header_test.dart (3)
8-8: LGTM! Documentation reference correctly updated.The documentation reference has been appropriately updated from
StrictValidationDocstoHeaderValidationDocs.
10-10: Consistent test group naming reflects new validation approach.The test group descriptions have been appropriately updated to use validation-based terminology.
Also applies to: 86-86
14-14: Server creation properly simplified to default configuration.Both test groups now use the parameterless
createServer()method, correctly reflecting the API changes.Also applies to: 90-90
test/headers/typed/content_language_header_test.dart (4)
8-8: LGTM! Documentation reference correctly updated.The documentation reference has been appropriately updated from
StrictValidationDocstoHeaderValidationDocs.
10-10: Consistent test group naming reflects new validation approach.The test group descriptions have been appropriately updated to use validation-based terminology.
Also applies to: 138-138
14-14: Server creation properly simplified to default configuration.Both test groups now use the parameterless
createServer()method, correctly reflecting the API changes.Also applies to: 142-142
4-4: Resolved — import and class matchtest/headers/docs/strict_validation_docs.dart exists and declares class HeaderValidationDocs; no change required.
test/headers/typed/cookie_header_test.dart (3)
8-8: Test group naming improved for clarity.The group description has been updated from referencing a "strict flag" to describing "validation" behavior, which better reflects the functionality being tested and aligns with the new validation approach documented in the PR.
12-12: Server setup simplified correctly.The removal of the explicit
strictHeadersparameter aligns with the broader refactor. ThecreateServer()call now uses default configuration, which maintains the same validation behavior while simplifying the API.
218-222: Consistent group naming and setup across validation scenarios.Both test groups now use the same server setup approach, which correctly reflects that the validation behavior is now handled differently (likely through lazy/on-demand validation as mentioned in the AI summary). The group naming is clear and consistent.
test/headers/typed/proxy_authenticate_header_test.dart (3)
8-8: Documentation reference updated appropriately.The reference to
HeaderValidationDocsinstead ofStrictValidationDocsaligns with the broader documentation restructuring mentioned in the PR objectives.
10-14: Test group and setup simplified correctly.The changes follow the same pattern as other test files - cleaner group naming and simplified server setup without explicit
strictHeadersconfiguration.
180-184: Consistent refactoring across validation scenarios.The "without validation" group setup matches the approach used in the "with validation" group, which is correct given the new validation model.
test/headers/typed/accept_header_test.dart (2)
8-8: Documentation reference correctly updated.Consistent with other files in updating the reference to
HeaderValidationDocs.
10-14: Uniform refactoring across test groups.Both validation scenarios now use the same simplified server setup approach. This is consistent with the PR's goal of removing the global
strictHeadersconfiguration and moving to a different validation model.Also applies to: 213-217
test/headers/typed/accept_language_test.dart (2)
8-8: Documentation reference updated consistently.The change to
HeaderValidationDocsmaintains consistency across the test suite.
11-16: Test naming and setup properly aligned.The group names now clearly describe the validation behavior being tested, and the server setup is consistently simplified across both validation scenarios.
Also applies to: 382-387
test/headers/typed/set_cookie_header_test.dart (1)
8-12: Consistent refactoring approach.The changes follow the same pattern as other header test files - improved group naming that describes behavior rather than implementation details, and simplified server setup.
Also applies to: 234-238
test/headers/typed/sec_fetch_dest_header_test.dart (2)
8-8: Documentation reference maintained consistently.The update to reference
HeaderValidationDocsis consistent with the broader documentation restructuring.
10-14: Clean and consistent test structure.Both validation test groups now use the same simplified setup approach, which correctly reflects the new validation model where behavior is determined at runtime rather than server initialization.
Also applies to: 98-102
test/headers/typed/range_header_test.dart (2)
8-8: Documentation reference updated appropriately.Maintains consistency with the documentation restructuring across the test suite.
10-14: Simplified and consistent test setup.The refactoring follows the established pattern - cleaner group naming and unified server setup approach across validation scenarios.
Also applies to: 201-205
test/headers/typed/access_control_allow_origin_header_test.dart (2)
8-8: Documentation reference correctly updated.Consistent with the broader documentation changes in the PR.
10-14: Test structure properly refactored.The changes align perfectly with the PR objectives - removing the global
strictHeadersconfiguration while maintaining clear test organization and consistent setup across validation scenarios.Also applies to: 182-186
test/headers/typed/retry_after_header_test.dart (3)
11-11: LGTM - Clean terminology update from strict flag to validation semantics.The test group names have been appropriately updated to reflect validation behavior rather than flag-based configuration. The server setup has been simplified to use the default
createServer()configuration, which aligns with the broader PR objective to remove thestrictHeadersparameter.Also applies to: 15-15
163-163: LGTM - Consistent terminology update for non-validation scenario.The second test group follows the same pattern as the first, updating from flag-based terminology to validation behavior terminology. The server setup correctly uses the default configuration.
Also applies to: 167-167
9-9: No change required — reference correct.strict_validation_docs.dart declares HeaderValidationDocs, so the comment's [HeaderValidationDocs] reference and the import match.
test/headers/headers_test_utils.dart (1)
57-60: LGTM - Method signature simplified correctly to remove strictHeaders parameter.The
createServer()method has been correctly updated to remove thestrictHeadersparameter and now creates a server with default configuration. This aligns with the PR's objective to remove the unused strict flag from the codebase. The RelicServer constructor call now only passes the adapter, which is consistent with the changes described in the AI summary.test/headers/typed/content_encoding_header_test.dart (2)
8-8: Same documentation reference concern as in retry_after_header_test.dart.The comment references
[HeaderValidationDocs]but imports fromstrict_validation_docs.dart. This needs verification to ensure the class name is correct.
10-10: LGTM - Consistent validation terminology and simplified server creation.The test groups have been appropriately renamed to use validation semantics instead of strict flag terminology. The server setup correctly uses the parameterless
createServer()method, consistent with the broader refactoring.Also applies to: 14-14, 164-164, 168-168
test/headers/typed/clear_site_data_header_test.dart (2)
8-8: Same documentation reference verification needed.The documentation comment references
[HeaderValidationDocs]while importing fromstrict_validation_docs.dart. This pattern appears across multiple test files and needs verification.
10-10: LGTM - Proper validation terminology and server setup simplification.The changes maintain consistency with the broader refactoring, replacing strict flag semantics with validation behavior terminology and using the simplified server creation.
Also applies to: 14-14, 138-138, 142-142
test/headers/basic/expires_header_test.dart (2)
9-9: Documentation reference needs verification - consistent pattern.Like other test files, this references
[HeaderValidationDocs]while importing fromstrict_validation_docs.dart.
12-12: LGTM - Consistent refactoring pattern applied correctly.The test follows the same successful pattern: validation terminology in group names and simplified server creation using the default configuration.
Also applies to: 17-17, 128-128, 132-132
test/headers/typed/vary_header_test.dart (2)
8-8: Documentation reference verification needed - same pattern.This file also references
[HeaderValidationDocs]while importing fromstrict_validation_docs.dart.
10-10: LGTM - Consistent validation-focused refactoring.The changes correctly implement the validation terminology and simplified server setup pattern used throughout the PR.
Also applies to: 14-14, 135-135, 139-139
test/headers/basic/via_header_test.dart (2)
8-8: Documentation reference verification needed - consistent issue.Same pattern: references
[HeaderValidationDocs]while importing fromstrict_validation_docs.dart.
10-10: LGTM - Proper implementation of the refactoring pattern.The changes correctly update terminology and server setup consistent with the broader PR objectives.
Also applies to: 14-14, 110-110, 114-114
test/headers/typed/authorization_header_test.dart (2)
11-11: Documentation reference verification needed - final occurrence.This file also references
[HeaderValidationDocs]while importing fromstrict_validation_docs.dart.
13-13: LGTM - Comprehensive test file properly refactored.Despite being the largest test file, it correctly implements the validation terminology changes and simplified server setup pattern consistently throughout all test groups.
Also applies to: 17-17, 476-476, 480-480
test/headers/typed/sec_fetch_site_header_test.dart (2)
8-8: Docs reference update looks goodLinking to HeaderValidationDocs is aligned with the new behavior.
10-16: Group retitle + setup are consistent with removal of strict flagcreateServer() without flags matches the new validation-on-use model.
test/headers/typed/accept_ranges_header_test.dart (2)
8-8: Docs reference update looks good
10-16: Group retitle + setup are consistent with removal of strict flagtest/headers/typed/cross_origin_opener_policy_header_test.dart (2)
8-8: Docs reference update looks good
10-16: Group retitle + setup are consistent with removal of strict flagtest/headers/typed/transfer_encoding_header_test.dart (2)
8-8: Docs reference update looks good
15-17: Setup aligns with new APItest/headers/basic/last_modified_header.dart (2)
9-9: Docs reference update looks good
11-16: Group retitle + setup are consistent with removal of strict flagtest/headers/basic/access_control_request_headers_header_test.dart (2)
8-8: Docs reference update looks good
11-17: Group retitle + setup are consistent with removal of strict flagtest/headers/typed/www_authenticate_header_test.dart (3)
8-8: Docs reference update looks good
10-16: Group retitle + setup are consistent with removal of strict flag
210-215: Setup aligns with new APItest/headers/basic/max_forwards_header_test.dart (3)
11-11: LGTM! Consistent refactoring to validation-based terminology.The test group names have been appropriately updated from strict flag terminology to validation-based terminology, which aligns with the PR's objective to remove the
strictHeadersflag.Also applies to: 144-144
16-16: Server creation successfully simplified.Both test groups now use the default
createServer()without any parameters, which is consistent with the removal of thestrictHeadersflag. This change aligns with the PR's objective to eliminate per-server strict header configuration.Also applies to: 148-148
8-8: Documentation import is correctHeaderValidationDocs is declared in test/headers/docs/strict_validation_docs.dart, so the existing import ../docs/strict_validation_docs.dart is correct — no rename or import change required.
Likely an incorrect or invalid review comment.
test/headers/basic/location_header_test.dart (2)
11-11: LGTM! Consistent terminology updates.The test group descriptions have been properly updated to use "validation" vs "without validation" terminology, which aligns with the broader refactoring.
Also applies to: 164-164
16-16: Server initialization properly simplified.Both test groups correctly use the parameterless
createServer()method, consistent with the removal of strict header configuration.Also applies to: 168-168
test/headers/typed/if_range_header_test.dart (2)
11-11: LGTM! Test group naming updated consistently.The refactoring from strict flag terminology to validation terminology is consistent across all test groups.
Also applies to: 139-139
15-15: Server setup correctly updated.Both test groups use the simplified
createServer()call, aligning with the API changes.Also applies to: 143-143
test/headers/basic/allow_header_test.dart (2)
11-11: LGTM! Test group naming consistently updated.The group descriptions properly reflect the new validation-based approach.
Also applies to: 132-132
16-16: Server creation properly simplified.Both groups correctly use the default
createServer()configuration.Also applies to: 136-136
test/headers/typed/proxy_authorization_header_test.dart (2)
12-12: LGTM! Test group naming updated appropriately.The validation-based terminology is consistent across all test groups.
Also applies to: 473-473
16-16: Server initialization correctly updated.Both test groups use the simplified server creation method as expected.
Also applies to: 477-477
test/headers/basic/trailer_header_test.dart (2)
10-10: LGTM! Test group naming consistently refactored.The group descriptions have been properly updated to reflect validation terminology.
Also applies to: 115-115
14-14: Server setup correctly simplified.Both test groups use the default
createServer()configuration as intended.Also applies to: 119-119
test/headers/basic/date_header_test.dart (2)
12-12: LGTM! Test group descriptions appropriately updated.The validation-based terminology is consistent with the refactoring objectives.
Also applies to: 128-128
17-17: Server creation properly updated.Both test groups correctly use the simplified
createServer()method.Also applies to: 132-132
test/headers/typed/access_control_request_method_header_test.dart (2)
10-10: LGTM! Test group naming properly updated.The validation terminology is consistently applied across all test groups.
Also applies to: 124-124
14-14: Server initialization correctly simplified.Both test groups appropriately use the default server creation method.
Also applies to: 128-128
test/headers/basic/content_location_header_test.dart (1)
151-156: “Without validation” suite setup LGTM.Tests correctly avoid typed access and assert valueOrNullIfInvalid behavior.
test/headers/typed/sec_fetch_mode_header_test.dart (2)
8-8: Doc link update LGTM.
10-16: Group rename + createServer() LGTM.test/headers/typed/permissions_policy_header_test.dart (3)
8-8: Doc link update LGTM.
10-16: Validation group + server setup LGTM.
106-112: “Without validation” suite setup LGTM.Pattern matches other headers: no typed access, then assert valueOrNullIfInvalid and throw on typed accessor.
test/headers/typed/access_control_allow_methods_header_test.dart (2)
8-8: Doc link update LGTM.
10-16: Validation group + server setup LGTM.test/headers/typed/access_control_allow_headers_header_test.dart (2)
8-8: Doc link update LGTM.
10-16: Validation group + server setup LGTM.test/headers/basic/age_header_test.dart (3)
8-8: Doc link update LGTM.
11-17: Validation group + server setup LGTM.
162-168: “Without validation” suite setup LGTM.Covers empty and invalid payloads with valueOrNullIfInvalid + typed access throws.
test/headers/typed/access_control_expose_headers_header_test.dart (3)
8-8: Doc link update LGTM.
10-16: Validation group + server setup LGTM.
164-170: “Without validation” suite setup LGTM.test/headers/typed/referrer_policy_header_test.dart (3)
8-8: Doc link update LGTM.
10-16: Validation group + server setup LGTM.
99-105: “Without validation” suite setup LGTM.test/headers/typed/strict_transport_security_header_test.dart (2)
11-11: LGTM: validation-mode framing and server setupGroup rename and default createServer() usage align with lazy/on-demand validation semantics.
Also applies to: 16-16
4-4: Import is correct — no change neededHeaderValidationDocs is defined in test/headers/docs/strict_validation_docs.dart (line 15), so the existing import '../docs/strict_validation_docs.dart' is correct.
Likely an incorrect or invalid review comment.
test/headers/typed/cache_control_header_test.dart (2)
10-10: LGTM: group renames and default serverRenames and default createServer() usage are consistent with the removal of strictHeaders.
Also applies to: 14-14, 329-329, 333-333
4-4: No change required — import is correcttest/headers/docs/strict_validation_docs.dart defines class HeaderValidationDocs (line 15); keep import '../docs/strict_validation_docs.dart'.
test/headers/typed/from_header_test.dart (2)
10-10: LGTM: validation group + default serverMatches the new lazy validation model.
Also applies to: 14-14
4-4: Keep import — no change requiredHeaderValidationDocs is declared in test/headers/docs/strict_validation_docs.dart (line 15); the existing import is correct.
Likely an incorrect or invalid review comment.
test/headers/typed/content_security_policy_header_test.dart (2)
10-10: LGTM: group renames and default serverConsistent with strictHeaders removal and lazy validation.
Also applies to: 14-14, 110-110, 114-114
4-4: Import is correct — keep ../docs/strict_validation_docs.darttest/headers/docs/strict_validation_docs.dart defines
class HeaderValidationDocs(line 15), so the proposed rename is unnecessary.Likely an incorrect or invalid review comment.
test/headers/basic/access_control_allow_credentials_header_test.dart (2)
16-23: LGTM: shared server setupCentralized setUp/tearDown reduces duplication and flakiness.
4-4: Import is correct — no change needed. The class HeaderValidationDocs is defined in test/headers/docs/strict_validation_docs.dart (line 15); leave the import as-is.Likely an incorrect or invalid review comment.
BREAKING CHANGE: Removes strictHeaders parameter from RelicServer constructor, serve() function, and createServer() test utility.
Corrects test descriptions that referenced non-existent 'strict flag'. Replaces 'with strict flag true/false' with 'with/without validation'
0c13d96 to
6098d42
Compare
SandPod
left a comment
There was a problem hiding this comment.
👍
Let's introduce this as a middleware at some point.
Description
This removes the already unused
strictHeadersflag and updates the tests.Related Issues
Pre-Launch Checklist
Please ensure that your PR meets the following requirements before submitting:
///), ensuring consistency with existing project documentation.Breaking Changes
Strictly speaking this is breaking in that it is no longer possible to set this flag, but previously it wasn't used anyway. This is just overdue cleanup.
Summary by CodeRabbit