Repository navigation
fix!: RelicServer cannot reliably know the Uri to use to hit it - #32
Conversation
📝 WalkthroughWalkthroughThe changes remove the inline URL construction logic from the production Changes
Sequence Diagram(s)sequenceDiagram
participant T as Test Suite
participant C as createServer()
participant S as RelicServer
T->>C: Call createServer(strictHeaders: false)
C->>S: Asynchronously initialize server instance
S->>S: Invoke inferUrl() to infer and store URL
S-->>C: Return initialized server instance
C-->>T: Provide server instance with associated URL
T->>S: Access server.url via extension getter
S-->>T: Return inferred URL
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/headers/headers_test_utils.dart (1)
16-52: Extension provides a clean replacement for the removed URL property.The extension elegantly replaces the removed
RelicServer.urlproperty with a test-specific implementation usingExpando. This approach correctly addresses the issue mentioned in the PR objectives that a server cannot reliably know what URL it will be accessed by until it receives a request.However, I noticed two potential improvements:
- The
urlgetter doesn't handle the case where no URL has been associated yet (it uses the non-null assertion operator!).- The
associateWithInferredUrl()method doesn't follow typical Dart conventions for method names or return types.Consider these improvements:
extension RelicServerTestEx on RelicServer { static final Expando<Uri> _serverUrls = Expando(); /// Fake [url] property for the [RelicServer] for testing purposes. Uri get url => _serverUrls[this]!; set url(Uri value) => _serverUrls[this] = value; + /// Checks if a URL has been associated with this server. + bool get hasUrl => _serverUrls[this] != null; /// Infer a probable URL for the server. /// /// In general a server cannot know what URL it is being accessed by before an /// actual request arrives, but for testing purposes we can infer a URL based /// on the server's address. Uri inferUrl() { if (server.address.isLoopback) { return Uri(scheme: 'http', host: 'localhost', port: server.port); } if (server.address.type == InternetAddressType.IPv6) { return Uri( scheme: 'http', host: '[${server.address.address}]', port: server.port, ); } return Uri( scheme: 'http', host: server.address.address, port: server.port, ); } /// Infer and store the URL for the server as fake property [url]. - associateWithInferredUrl() { + /// Returns this server instance for method chaining. + RelicServer associateWithInferredUrl() { url = inferUrl(); + return this; } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
lib/src/relic_server.dart(0 hunks)test/headers/headers_test_utils.dart(1 hunks)test/relic_server_test.dart(1 hunks)
💤 Files with no reviewable changes (1)
- lib/src/relic_server.dart
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Run Unit Tests (macos-latest, 3.3.0)
🔇 Additional comments (6)
test/relic_server_test.dart (3)
8-8: Added necessary import for the new test utilities.The new import provides access to the
createServerfunction and theRelicServerTestExextension that adds URL support toRelicServerinstances for testing purposes.
14-15: Simplified server initialization properly.The previous complex code that attempted to create a server with IPv6 and fall back to IPv4 has been replaced with a cleaner approach that delegates to the
createServerfunction. This is a good simplification that maintains the same functionality.
24-26:Details
❓ Verification inconclusive
Verify URL property usage in tests.
These tests are using
server.urlwhich previously came from theRelicServerclass itself. Now it's coming from the extension method in the testing utilities. The code works but relies on the extension being properly associated with the server instance.Also applies to: 33-36, 42-45
🏁 Script executed:
#!/bin/bash # Check if RelicServer originally had a url property that's been removed # Look for the definition of the RelicServer class echo "Checking original RelicServer implementation for url property:" echo "------------------------------------------------------------" rg -p "class RelicServer" lib/src/relic_server.dart -A 30 # Search for references to server.url in other tests echo -e "\nChecking for other usages of server.url in tests:" echo "----------------------------------------------" rg "server\.url" test/ --glob "!**/relic_server_test.dart" --glob "!**/headers_test_utils.dart"Length of output: 1589
Attention: Verify Test URL Extension Usage
Confirm that all test files (specifically intest/relic_server_test.dartat lines 24–26, 33–36, and 42–45) correctly rely on the URL extension method from the testing utilities rather than a nativeurlproperty onRelicServer. The refactoredRelicServerno longer defines aurlproperty (as shown inlib/src/relic_server.dart), so the tests depend on the extension being properly imported and applied to each server instance. Please manually verify that the extension is consistently available (e.g., via an import of the testing utilities) in all affected tests to prevent any silent dependency issues.test/headers/headers_test_utils.dart (3)
61-66: Addedawaitand URL association.Good changes to ensure the server creation is properly awaited and to associate the server with its inferred URL for testing purposes.
68-74: Addedawaitand URL association to the fallback case.Good changes to ensure the server creation is properly awaited and to associate the server with its inferred URL for testing purposes, even in the fallback case.
99-99:Details
❓ Verification inconclusive
Verify compatibility with the new URL extension.
This line uses
server.urlwhich now comes from the extension rather than from theRelicServerclass itself. Ensure that the URL is properly associated before this line is executed.
🏁 Script executed:
#!/bin/bash # Check if getServerRequestHeaders is called with servers that have URLs associated # Look for usages of getServerRequestHeaders in tests echo "Looking for usages of getServerRequestHeaders:" echo "-------------------------------------------" rg "getServerRequestHeaders" test/ -B 5 -A 2Length of output: 119381
Action Required: Manually confirm that the new URL extension is active.
The call to
http.get(server.url, headers: headers)now relies on the URL coming from the extension rather than the originalRelicServerimplementation. Although our grep results show that various tests invokegetServerRequestHeaderson servers, none explicitly confirm that the URL extension has been applied before this call. Please double‑check (or add a dedicated test) to ensure that the extension correctly associates a valid URL toserver.urlprior to the HTTP request.
80f8f44 to
0744860
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
test/headers/headers_test_utils.dart (1)
99-99: 💡 Verification agent🧩 Analysis chain
Verify code depending on server.url property.
This line uses the newly created testing extension's URL functionality. Since this represents a change in how URLs are handled, ensure all other test files that use
server.urlhave been updated to use this extension.
🏁 Script executed:
#!/bin/bash # Search for any other usages of server.url that might need updating echo "Searching for other usages of server.url:" rg "server\.url" --type dart --exclude "headers_test_utils.dart"Length of output: 569
Below is a revised review comment that proposes a re-verification (using an updated search command) to ensure no other test files still rely on the old URL implementation:
Action: Confirm All References to
server.urlAre UpdatedThis change updates the usage of
server.urlintest/headers/headers_test_utils.dartso it now leverages the new testing extension’s URL functionality. Please verify that no other test files still referenceserver.urlwith the old behavior. For a more reliable search, use this updated command (which excludes the headers test file):If this command produces no output, then it confirms that no other files require the update. Otherwise, please update any additional occurrences accordingly.
Please run the above search to manually verify the absence of outdated references in the codebase.
🏁 Script executed:
#!/bin/bash echo "Searching for other usages of server.url (excluding test/headers/headers_test_utils.dart):" rg "server\.url" --type dart -g '!test/headers/headers_test_utils.dart'Length of output: 654
Action: Update Test References to Use the New URL Extension
The updated URL functionality in
test/headers/headers_test_utils.dartis not yet consistently applied. Our search revealed that intest/relic_server_test.darttheserver.urlproperty is still being used:
final response = await http.read(server.url);.get(Uri.parse('${server.url}/%D0%C2%BD%A8%CE%C4%BC%FE%BC%D0.zip'));final delayedResponse = http.read(server.url);Please update these occurrences to use the new testing extension's API for URL handling. For consistency, follow the same pattern implemented in the headers test file.
🧹 Nitpick comments (1)
test/headers/headers_test_utils.dart (1)
16-52: Well-designed testing extension to handle server URL inference.This extension elegantly addresses the issue where
RelicServercan't reliably determine its own URL. TheExpandoapproach is a clean way to associate external data with existing objects without modifying their class definitions. The URL inference logic is comprehensive, handling different address types appropriately.Two small improvements to consider:
- Consider adding a null check in the getter to provide a more helpful error message:
- Uri get url => _serverUrls[this]!; + Uri get url { + final uri = _serverUrls[this]; + if (uri == null) { + throw StateError('No URL associated with this RelicServer. Call associateWithInferredUrl() first.'); + } + return uri; + }
- Add a return type to the
associateWithInferredUrlmethod for consistency:- associateWithInferredUrl() { + void associateWithInferredUrl() {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
lib/src/relic_server_serve.dart(0 hunks)test/headers/headers_test_utils.dart(1 hunks)test/relic_server_test.dart(1 hunks)
💤 Files with no reviewable changes (1)
- lib/src/relic_server_serve.dart
🚧 Files skipped from review as they are similar to previous changes (1)
- test/relic_server_test.dart
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Run Unit Tests (macos-latest, 3.3.0)
🔇 Additional comments (2)
test/headers/headers_test_utils.dart (2)
61-66: Proper asynchronous handling with server instance initialization.Good job adding the
awaitkeyword to properly handle the asynchronous server creation and using the cascade operator to associate the server with its inferred URL.
68-74: Consistent error handling with proper async/await pattern.The IPv4 fallback logic correctly mirrors the primary implementation with proper async/await handling and URL association.
c5d2dd3 to
7d8c4ee
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/headers/headers_test_utils.dart (1)
34-52: Consider adding handling for non-standard ports in URL inference.The URL inference logic handles different address types well but doesn't account for potential non-standard port configurations in the host string. Some HTTP clients might require special formatting when the port is not the standard HTTP port 80.
Consider enhancing the inference logic to only include the port in the URL when it's not the standard HTTP port:
Uri inferUrl() { if (server.address.isLoopback) { - return Uri(scheme: 'http', host: 'localhost', port: server.port); + return Uri( + scheme: 'http', + host: 'localhost', + port: server.port != 80 ? server.port : null + ); } if (server.address.type == InternetAddressType.IPv6) { return Uri( scheme: 'http', host: '[${server.address.address}]', - port: server.port, + port: server.port != 80 ? server.port : null, ); } return Uri( scheme: 'http', host: server.address.address, - port: server.port, + port: server.port != 80 ? server.port : null, ); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
lib/src/relic_server_serve.dart(0 hunks)test/headers/headers_test_utils.dart(1 hunks)test/relic_server_test.dart(1 hunks)
💤 Files with no reviewable changes (1)
- lib/src/relic_server_serve.dart
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Run Unit Tests (macos-latest, 3.3.0)
🔇 Additional comments (6)
test/relic_server_test.dart (3)
7-7: Added appropriate import for testing utilities.This import is necessary to use the extended functionality provided in the test utilities file, particularly the new
createServerfunction and theRelicServerTestExextension which handles URL association for test servers.
14-14: Simplified server setup with improved async handling.The server initialization has been refactored from a try-catch pattern to a cleaner async approach using the
createServerfunction. This simplifies the test setup and abstracts away the IPv4/IPv6 fallback logic.The
strictHeaders: falseparameter is properly passed through to maintain the same test behavior.
24-25:Details
❓ Verification inconclusive
Verify all usages of server.url are working with the new extension.
The PR removes the built-in
urlproperty fromRelicServerand replaces it with an extension method in the test utilities. Ensure all these usages ofserver.urlcontinue to work as expected with the new implementation.Also applies to: 33-34, 41-41
🏁 Script executed:
#!/bin/bash # Check if there are any other usages of server.url in tests that might need updating rg -g "test/**/*.dart" "server.url" --no-filename | wc -lLength of output: 59
Action: Confirm that all instances of
server.urlcorrectly invoke the new extension method.I confirmed via the search script that there are 4 occurrences of
server.urlin the tests. The locations specified in the review comment (lines 24-25, 33-34, 41-41 intest/relic_server_test.dart) account for three of these. Please double-check the remaining occurrence to ensure it’s intentionally left as-is and that every usage ofserver.urlin the tests properly benefits from the new extension method.test/headers/headers_test_utils.dart (3)
16-56: Well-designed extension for test-only URL handling.The extension properly addresses the issue where a server cannot reliably know its URL until it receives a request. The implementation has several strengths:
- Uses
Expando<Uri>to associate URLs with server instances without modifying the class- Provides descriptive error messages when the URL hasn't been set
- Implements URL inference that handles different address types (loopback, IPv6, IPv4)
- Clear documentation explaining the purpose and limitations
This is a good solution that maintains backward compatibility in tests while fixing the design issue in the core server.
65-70: Added proper async handling and URL association to server creation.The changes correctly:
- Add
awaitto the server creation calls, ensuring the server is fully initialized before returning- Use the cascade operator (
..) to associate the server with its inferred URL- Maintain the existing IPv6/IPv4 fallback behavior
This implementation properly connects the new URL extension with the server creation process, ensuring tests continue to work with the refactored architecture.
Also applies to: 72-77
103-103:Details
❓ Verification inconclusive
Verify this usage of server.url is compatible with extension.
This line uses
server.urlwhich now comes from the extension rather than from theRelicServerclass directly. Ensure that the server passed to this function has been properly associated with a URL using eitherserver.url = ...orserver.associateWithInferredUrl().
🏁 Script executed:
#!/bin/bash # Check if the getServerRequestHeaders function is called anywhere without proper URL association rg -A 5 "getServerRequestHeaders" --no-filename | grep -v "associateWithInferredUrl"Length of output: 90195
ACTION: Verify the Server URL Association in Tests
The current implementation in
test/headers/headers_test_utils.dart(line 103) uses the extended propertyserver.urlin the call:final response = await http.get(server.url, headers: headers);However, our grep results for calls to
getServerRequestHeadersshow that none of them explicitly call
server.associateWithInferredUrl()(or setserver.urldirectly) before passing the server instance. This is concerning because the extension now provides the URL for a server only if it has been properly associated with one.Please ensure that the server instance passed to this function is initialized correctly—either by explicitly setting
server.urlor by callingserver.associateWithInferredUrl()in the test setup. This verification is critical to guarantee that the HTTP request uses the correct URL provided by the extension.
…ng (avoids a larger test refactoring)
7d8c4ee to
b7aa350
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
test/headers/headers_test_utils.dart (1)
92-92: 💡 Verification agent🧩 Analysis chain
Verify that all test files using server.url have been updated.
This line now relies on the extension property
urlrather than a property on the originalRelicServerclass. Since this is a breaking change, we should ensure all relevant test files have been updated to import this extension.
🏁 Script executed:
#!/bin/bash # Look for all files using server.url to ensure they import the extension echo "Files that might need updating to use the new RelicServerTestEx extension:" rg -l "server\.url" --type dart --glob "!test/headers/headers_test_utils.dart" echo -e "\nChecking if these files import the extension:" for file in $(rg -l "server\.url" --type dart --glob "!test/headers/headers_test_utils.dart"); do if ! grep -q "import '.*test/headers/headers_test_utils.dart" "$file"; then echo "WARNING: $file uses server.url but may not import the extension" fi doneLength of output: 823
Critical: Missing Extension Import in Test Files
- The code in
test/headers/headers_test_utils.dartnow relies on the extension propertyurl(viaRelicServerTestEx), meaning that any test file usingserver.urlmust import this extension.- Our verification revealed that
test/relic_server_test.dartusesserver.urlbut did not import the extension.- Action Required:
- Update
test/relic_server_test.dart(and any other test files usingserver.url) to import the extension. For example, add the following at the top oftest/relic_server_test.dartif not already present:import 'test/headers/headers_test_utils.dart';
🧹 Nitpick comments (2)
test/headers/headers_test_utils.dart (2)
16-47: Well-designed extension for testing purposes!This extension elegantly solves the issue of reliably determining a server's URL by providing a test-specific implementation. Using an
Expandoto associate URLs with server instances is a good approach that doesn't require modifying the original class. The_inferUrl()method handles different address types appropriately, making it robust for various test scenarios.This is a good example of the extension pattern for testing-specific functionality without polluting production code. The clear documentation also makes the purpose and limitations of this approach explicit.
85-85: Clarifying comment added to toMap() call.The added comment explains that this call is meant to parse all headers eagerly, improving code readability.
Consider adding a small inline explanation of why eager parsing might be necessary in some test scenarios.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
lib/src/relic_server_serve.dart(0 hunks)test/headers/headers_test_utils.dart(2 hunks)test/relic_server_test.dart(1 hunks)
💤 Files with no reviewable changes (1)
- lib/src/relic_server_serve.dart
🚧 Files skipped from review as they are similar to previous changes (1)
- test/relic_server_test.dart
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Run Unit Tests (macos-latest, 3.3.0)
🔇 Additional comments (4)
test/headers/headers_test_utils.dart (4)
19-21: Good documentation on the fake URL property.The comments clearly explain that this is a testing-specific property, helping future developers understand its purpose and limitations.
23-28: Excellent documentation for the _inferUrl method.The comment explains precisely why this method exists and acknowledges the limitation that a server generally cannot know its URL before receiving a request. This is important context for maintainers.
56-57: Correctly added await to server creation.Adding
awaitensures proper asynchronous behavior when creating servers, which is important sinceRelicServer.createServeris an asynchronous method.
62-63: Correctly added await to fallback server creation.The same improvement as above, ensuring consistent async handling in the fallback case.
SandPod
left a comment
There was a problem hiding this comment.
Single NIT suggestion, otherwise the change looks good! 👍
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
test/headers/basic/referer_header_test.dart (1)
91-91: Consistent parameter name change fromparseAllHeaderstoeagerHeaderParsingThis parameter name change better describes the actual behavior. "Eager parsing" is a more precise term for what the parameter controls - whether headers are parsed immediately when received or only when accessed. This change aligns with the PR's goal of improving how RelicServer handles incoming requests.
Consider adding a simple doc comment in the
getServerRequestHeadersfunction implementation to clarify whateagerHeaderParsing: falsedoes, especially explaining how it relates to the test scenarios where invalid headers are being tested.test/headers/basic/access_control_request_headers_heder_test.dart (1)
51-51: Parameter renaming improves API readability.The change from
parseAllHeaderstoeagerHeaderParsingmakes the parameter's purpose clearer, indicating that this flag controls whether headers are parsed immediately or on-demand.Note: The filename contains a typo - "heder_test.dart" should be "header_test.dart". This isn't related to your current PR, but might be worth addressing in a future cleanup.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (65)
test/headers/basic/access_control_allow_credentials_header_test.dart(1 hunks)test/headers/basic/access_control_max_age_header_test.dart(1 hunks)test/headers/basic/access_control_request_headers_heder_test.dart(1 hunks)test/headers/basic/age_header_test.dart(1 hunks)test/headers/basic/allow_header_test.dart(1 hunks)test/headers/basic/content_location_header_test.dart(1 hunks)test/headers/basic/date_header_test.dart(1 hunks)test/headers/basic/expires_header_test.dart(1 hunks)test/headers/basic/host_header_test.dart(1 hunks)test/headers/basic/if_modified_since_header_test.dart(1 hunks)test/headers/basic/if_unmodified_since_header_test.dart(1 hunks)test/headers/basic/last_modified_header.dart(1 hunks)test/headers/basic/location_header_test.dart(1 hunks)test/headers/basic/max_forwards_header_test.dart(1 hunks)test/headers/basic/origin_header_test.dart(1 hunks)test/headers/basic/referer_header_test.dart(1 hunks)test/headers/basic/server_header_test.dart(1 hunks)test/headers/basic/trailer_header_test.dart(1 hunks)test/headers/basic/user_agent_header_test.dart(1 hunks)test/headers/basic/via_header_test.dart(1 hunks)test/headers/headers_test_utils.dart(2 hunks)test/headers/typed_headers/accept_encoding_header_test.dart(1 hunks)test/headers/typed_headers/accept_header_test.dart(1 hunks)test/headers/typed_headers/accept_language_test.dart(1 hunks)test/headers/typed_headers/accept_ranges_header_test.dart(1 hunks)test/headers/typed_headers/access_control_allow_headers_header_test.dart(1 hunks)test/headers/typed_headers/access_control_allow_methods_header_test.dart(1 hunks)test/headers/typed_headers/access_control_allow_origin_header_test.dart(1 hunks)test/headers/typed_headers/access_control_expose_headers_header_test.dart(1 hunks)test/headers/typed_headers/access_control_request_method_header_test.dart(1 hunks)test/headers/typed_headers/authorization_header_test.dart(1 hunks)test/headers/typed_headers/cache_control_header_test.dart(1 hunks)test/headers/typed_headers/clear_site_data_header_test.dart(1 hunks)test/headers/typed_headers/connection_header_test.dart(1 hunks)test/headers/typed_headers/content_disposition_header_test.dart(1 hunks)test/headers/typed_headers/content_encoding_header_test.dart(1 hunks)test/headers/typed_headers/content_language_header_test.dart(1 hunks)test/headers/typed_headers/content_range_header_test.dart(1 hunks)test/headers/typed_headers/content_security_policy_header_test.dart(1 hunks)test/headers/typed_headers/cookie_header_test.dart(1 hunks)test/headers/typed_headers/cross_origin_embedder_policy_header_test.dart(1 hunks)test/headers/typed_headers/cross_origin_opener_policy_header_test.dart(1 hunks)test/headers/typed_headers/cross_origin_resource_policy_header_test.dart(1 hunks)test/headers/typed_headers/etag_header_test.dart(1 hunks)test/headers/typed_headers/expect_header_test.dart(1 hunks)test/headers/typed_headers/from_header_test.dart(1 hunks)test/headers/typed_headers/if_match_header_test.dart(1 hunks)test/headers/typed_headers/if_none_match_header_test.dart(1 hunks)test/headers/typed_headers/if_range_header_test.dart(1 hunks)test/headers/typed_headers/permissions_policy_header_test.dart(1 hunks)test/headers/typed_headers/proxy_authenticate_header_test.dart(1 hunks)test/headers/typed_headers/proxy_authorization_header_test.dart(1 hunks)test/headers/typed_headers/range_header_test.dart(1 hunks)test/headers/typed_headers/referrer_policy_header_test.dart(1 hunks)test/headers/typed_headers/retry_after_header_test.dart(1 hunks)test/headers/typed_headers/sec_fetch_dest_header_test.dart(1 hunks)test/headers/typed_headers/sec_fetch_mode_header_test.dart(1 hunks)test/headers/typed_headers/sec_fetch_site_header_test.dart(1 hunks)test/headers/typed_headers/set_cookie_header_test.dart(1 hunks)test/headers/typed_headers/strict_transport_security_header_test.dart(1 hunks)test/headers/typed_headers/te_header_test.dart(1 hunks)test/headers/typed_headers/transfer_encoding_header_test.dart(1 hunks)test/headers/typed_headers/upgrade_header_test.dart(1 hunks)test/headers/typed_headers/vary_header_test.dart(1 hunks)test/headers/typed_headers/www_authenticate_header_test.dart(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- test/headers/typed_headers/cache_control_header_test.dart
🚧 Files skipped from review as they are similar to previous changes (1)
- test/headers/headers_test_utils.dart
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Run Unit Tests (macos-latest, 3.3.0)
🔇 Additional comments (63)
test/headers/typed_headers/sec_fetch_mode_header_test.dart (1)
64-64: Consistency update: Parameter nameparseAllHeaderschanged toeagerHeaderParsingThis change is part of a broader effort to rename this parameter across the test suite for better clarity. The parameter controls whether headers are parsed eagerly (immediately) or lazily (only when accessed). The new name is more descriptive of the actual behavior, improving code readability.
test/headers/typed_headers/sec_fetch_site_header_test.dart (1)
64-64: Renamed parameter for improved clarityThe parameter
parseAllHeadershas been renamed toeagerHeaderParsingto better reflect its actual behavior. This is consistent with the same change made in other test files.test/headers/typed_headers/sec_fetch_dest_header_test.dart (1)
64-64: Consistent parameter renaming for clarityThe parameter name change from
parseAllHeaderstoeagerHeaderParsingimproves the code by more accurately describing the parameter's purpose: it controls whether headers are parsed immediately or only when accessed.test/headers/basic/age_header_test.dart (1)
108-108: Parameter name updated for consistency and clarityThe parameter
parseAllHeadershas been renamed toeagerHeaderParsing, which more accurately describes its function - controlling whether header parsing happens eagerly (immediately) or lazily (only when accessed). This change is consistent with similar updates across the test suite.test/headers/typed_headers/cross_origin_embedder_policy_header_test.dart (1)
65-65: Updated parameter name for clarity and consistency.The parameter has been renamed from
parseAllHeaderstoeagerHeaderParsing, which better represents its function and aligns with the parameter naming convention that's being standardized across the test suite.test/headers/typed_headers/expect_header_test.dart (1)
67-67: Parameter naming standardized for consistency.The parameter has been renamed from
parseAllHeaderstoeagerHeaderParsing, matching the naming convention applied across the test suite. This provides better clarity about the parameter's purpose.test/headers/typed_headers/permissions_policy_header_test.dart (1)
46-46: Consistent parameter naming across test suite.The parameter has been renamed from
parseAllHeaderstoeagerHeaderParsing, which better describes its functionality and maintains consistency with the same change being made across the test suite.test/headers/typed_headers/etag_header_test.dart (1)
69-69: Updated parameter name to improve code readability.The parameter has been renamed from
parseAllHeaderstoeagerHeaderParsing, which provides a clearer indication of its purpose - controlling whether headers should be parsed eagerly or lazily. This renaming is part of a broader standardization effort across the test suite.test/headers/basic/if_unmodified_since_header_test.dart (1)
70-70: Parameter rename reflects clearer intention.The renaming from
parseAllHeaderstoeagerHeaderParsingimproves code readability by more clearly expressing the intent of this parameter. The new name better describes the behavior - controlling whether headers are parsed eagerly or lazily.test/headers/basic/trailer_header_test.dart (1)
46-46: Parameter rename improves clarity.The parameter rename from
parseAllHeaderstoeagerHeaderParsingbetter communicates the intent of this flag - to control whether headers are parsed eagerly or on-demand.test/headers/basic/origin_header_test.dart (1)
90-90: Consistent parameter renaming improves code clarity.The parameter rename from
parseAllHeaderstoeagerHeaderParsingis consistent with the changes in other test files and better represents the functionality - controlling whether headers are parsed eagerly or lazily.test/headers/typed_headers/connection_header_test.dart (1)
70-70: Parameter rename enhances semantic clarity.The change from
parseAllHeaderstoeagerHeaderParsingmakes the parameter's purpose more explicit and maintains consistency with other test files. This renaming is part of the broader refactoring to address theRelicServerURL reliability issue mentioned in the PR description.test/headers/basic/allow_header_test.dart (1)
69-69: Parameter name updated for clarityThe change from
parseAllHeaderstoeagerHeaderParsingprovides better semantics about what the parameter actually controls. This naming is more descriptive of the actual functionality - eager parsing versus lazy parsing of headers.test/headers/typed_headers/from_header_test.dart (1)
70-70: Consistent parameter renamingGood job on consistently renaming the parameter across test files from
parseAllHeaderstoeagerHeaderParsing. This makes the parameter name more descriptive of its actual functionality.test/headers/basic/last_modified_header.dart (1)
70-70: Parameter name updated for clarityThe parameter renaming from
parseAllHeaderstoeagerHeaderParsingbetter describes the functionality, making the code more self-documenting.test/headers/basic/via_header_test.dart (1)
47-47: Consistent parameter renamingRenaming from
parseAllHeaderstoeagerHeaderParsingaligns with the changes in other test files and better communicates the purpose of this parameter.test/headers/typed_headers/referrer_policy_header_test.dart (1)
64-64: Parameter name updated fromparseAllHeaderstoeagerHeaderParsingThis change improves clarity by using a more descriptive parameter name. The new name better reflects the behavior of eagerly parsing headers upon receipt rather than parsing them on demand.
test/headers/typed_headers/if_range_header_test.dart (1)
70-70: Parameter name updated fromparseAllHeaderstoeagerHeaderParsingThis change improves clarity by using a more descriptive parameter name. The new name better reflects the behavior of eagerly parsing headers upon receipt rather than parsing them on demand.
test/headers/basic/user_agent_header_test.dart (1)
49-49: Parameter name updated fromparseAllHeaderstoeagerHeaderParsingThis change improves clarity by using a more descriptive parameter name. The new name better reflects the behavior of eagerly parsing headers upon receipt rather than parsing them on demand.
test/headers/typed_headers/accept_header_test.dart (1)
65-65: Parameter name updated fromparseAllHeaderstoeagerHeaderParsingThis change improves clarity by using a more descriptive parameter name. The new name better reflects the behavior of eagerly parsing headers upon receipt rather than parsing them on demand.
test/headers/typed_headers/content_disposition_header_test.dart (1)
46-46: Renamed parameter improves clarity.The parameter name change from
parseAllHeaderstoeagerHeaderParsingprovides a more descriptive term that better explains the intention of this flag. This aligns with the PR's focus on improving how the server handles requests and processes headers.test/headers/typed_headers/if_none_match_header_test.dart (1)
90-90: Renamed parameter improves semantic clarity.The parameter name change from
parseAllHeaderstoeagerHeaderParsingbetter communicates the purpose of this flag - to control when headers are parsed (eagerly or lazily) rather than simply whether all headers are parsed.test/headers/basic/content_location_header_test.dart (1)
91-91: Renamed parameter maintains consistency across test suite.The parameter rename from
parseAllHeaderstoeagerHeaderParsingkeeps the API usage consistent with other test files in the suite. This change improves code coherence and readability.test/headers/typed_headers/content_language_header_test.dart (2)
69-69: Renamed parameter aligns with PR objective.The parameter name change from
parseAllHeaderstoeagerHeaderParsingis consistent with the PR's goal of improving how RelicServer handles requests. This more descriptive name better reflects the actual behavior - controlling when header parsing occurs rather than which headers are parsed.
1-171:Details
❓ Verification inconclusive
Verify impact of server URL handling changes.
While the parameter rename is clear, I don't see direct evidence of the changes mentioned in the PR description regarding the removal of
RelicServer.urlproperty. Let's confirm that tests still function correctly with the new server URL handling approach.
🏁 Script executed:
#!/bin/bash # Find references to RelicServer.url property to ensure it's no longer being used echo "Looking for references to RelicServer.url in the codebase..." rg -l "RelicServer.*\.url" --type dart echo "Looking for the potential expando implementation for test URL handling..." rg -A 10 -B 5 "Expando.*RelicServer" --type dartLength of output: 379
Review Update: Confirm Server URL Handling Changes
The parameter rename appears solid, and our automated searches did not show any references to a removed
RelicServer.urlproperty or alternate expando-based URL handling. However, the lack of output from the verification script means we couldn’t conclusively capture every potential usage. Please manually verify that the new server URL handling approach is consistently applied across the codebase and that all related tests continue to pass as expected.test/headers/typed_headers/cross_origin_opener_policy_header_test.dart (1)
65-65: Updated parameter name for consistency with renamed APIThe parameter has been renamed from
parseAllHeaderstoeagerHeaderParsing, which more clearly reflects its purpose - controlling whether headers are parsed immediately or on-demand. This change is consistent with the PR's objective to improve how RelicServer handles request processing.test/headers/typed_headers/www_authenticate_header_test.dart (1)
45-45: Updated parameter name for consistency with renamed APIThe parameter has been renamed from
parseAllHeaderstoeagerHeaderParsing, maintaining consistent behavior with the implementation change in the underlying function. This new name better describes the purpose of the parameter - controlling whether headers are parsed eagerly or lazily.test/headers/typed_headers/transfer_encoding_header_test.dart (1)
65-65: Updated parameter name for consistency with renamed APIThe parameter has been renamed from
parseAllHeaderstoeagerHeaderParsing, which better reflects its actual functionality in controlling when headers are parsed. This change is part of a consistent update across all test files that use this function.test/headers/typed_headers/access_control_allow_headers_header_test.dart (2)
68-68: Updated parameter name for consistency with renamed APIThe parameter has been renamed from
parseAllHeaderstoeagerHeaderParsing, which more accurately describes its behavior in controlling header parsing timing. This change is applied consistently across all test files that use thegetServerRequestHeadersfunction.
1-156:Details
✅ Verification successful
Verify that all instances of this parameter have been updated
All test files that call the
getServerRequestHeadersfunction should be updated to use the new parameter name. This ensures consistent API usage across the codebase.
🏁 Script executed:
#!/bin/bash # Description: Check if there are any remaining usages of the old parameter name # Search for any remaining instances of parseAllHeaders in test files echo "Checking for any remaining instances of the old 'parseAllHeaders' parameter..." rg "parseAllHeaders:" "test/" --type dart # Count and report findings if [ $? -eq 0 ]; then echo "Found instances of the old parameter name that might need to be updated." else echo "No instances of the old parameter name found. All files have been updated correctly." fiLength of output: 409
All instances of the parameter have been successfully updated
The search script confirms that no references to the old
parseAllHeadersparameter remain in the test files. All calls togetServerRequestHeadersare using the new parameter name, ensuring consistent API usage across the codebase.test/headers/typed_headers/access_control_expose_headers_header_test.dart (1)
73-73: Parameter name change improves clarity.The parameter name change from
parseAllHeaderstoeagerHeaderParsingbetter describes the behavior - it's about when headers are parsed rather than which headers are parsed. This aligns with the PR objective of addressing how the server handles requests.test/headers/typed_headers/strict_transport_security_header_test.dart (1)
85-85: Parameter renaming maintains consistent terminology.The parameter name change from
parseAllHeaderstoeagerHeaderParsingis consistent with the changes in other test files and provides a more accurate description of the parameter's purpose.test/headers/typed_headers/set_cookie_header_test.dart (1)
169-169: Clear parameter naming enhances code readability.The renamed parameter
eagerHeaderParsingbetter indicates that this controls when headers are parsed rather than which headers are parsed, improving the understanding of the test function's behavior.test/headers/typed_headers/upgrade_header_test.dart (1)
65-65: Parameter renaming provides consistent terminology across tests.The change from
parseAllHeaderstoeagerHeaderParsingbetter reflects the behavior of delayed header parsing and aligns with similar changes in other test files. This naming consistency makes the codebase more maintainable.test/headers/typed_headers/proxy_authenticate_header_test.dart (1)
45-45: Improved naming convention for header parsing parameterThe parameter name change from
parseAllHeaderstoeagerHeaderParsingbetter represents the functionality - whether headers should be parsed eagerly (immediately) or lazily (on-demand). This is more semantically clear and aligns with the PR's goal of improving how the server handles requests.test/headers/typed_headers/content_encoding_header_test.dart (1)
70-70: Consistent parameter naming improves readabilityThe parameter rename from
parseAllHeaderstoeagerHeaderParsingmatches the changes made throughout the codebase. This name better describes the behavior - controlling whether header validation happens immediately when headers are received or only when they're actually accessed.test/headers/typed_headers/content_range_header_test.dart (1)
112-112: Parameter name more accurately describes behaviorThe rename from
parseAllHeaderstoeagerHeaderParsingprovides better clarity about the functionality - it controls whether header validation happens immediately or on-demand. The parameter is set tofalsehere to verify that the server doesn't validate the header until it's actually used.test/headers/typed_headers/authorization_header_test.dart (1)
52-52: Consistent terminology across test filesThe parameter name change enhances consistency and clarity. Setting
eagerHeaderParsing: falseallows the test to verify that invalid headers don't cause a bad request until they're actually accessed, which is important for the test's assertion.test/headers/typed_headers/accept_language_test.dart (1)
112-112: Approved parameter renaming for improved clarity.The renaming from
parseAllHeaderstoeagerHeaderParsingbetter describes the actual behavior of this parameter. This change is part of the broader refactoring related to how RelicServer handles requests and improves code readability.test/headers/typed_headers/retry_after_header_test.dart (1)
47-47: Approved parameter renaming for better semantics.The parameter name change from
parseAllHeaderstoeagerHeaderParsingprovides a more accurate description of the parameter's functionality, indicating whether headers are parsed immediately or only when accessed.test/headers/typed_headers/vary_header_test.dart (1)
67-67: Approved parameter name change for semantic clarity.The renaming from
parseAllHeaderstoeagerHeaderParsingbetter reflects the parameter's purpose, which is to control whether headers are parsed eagerly (immediately) or lazily (only when needed).test/headers/typed_headers/proxy_authorization_header_test.dart (1)
54-54: Approved parameter renaming for consistency.The parameter has been renamed from
parseAllHeaderstoeagerHeaderParsingto better reflect its actual behavior. This change is consistent with similar updates across other test files and aligns with the PR's goal of improving how RelicServer handles requests.test/headers/typed_headers/accept_encoding_header_test.dart (1)
111-111: Consistent parameter renaming toeagerHeaderParsingThis change continues the consistent renaming pattern across test files. The parameter name
eagerHeaderParsingmore accurately reflects the behavior - controlling whether headers are parsed immediately or lazily on access, which is important for the test functionality.test/headers/typed_headers/te_header_test.dart (1)
91-91: Parameter renamed for consistency across test filesThe renaming of
parseAllHeaderstoeagerHeaderParsingmaintains consistency with the changes in other test files. This improves code clarity by using terminology that better describes the actual behavior of the parameter.test/headers/typed_headers/clear_site_data_header_test.dart (1)
85-85:Details
✅ Verification successful
Parameter name change matches the updated API pattern
The change from
parseAllHeaderstoeagerHeaderParsingis consistent with the other files and improves the API's clarity. This brings the test in line with the PR's overall goal of improving how RelicServer handles requests and responses.The PR objectives mention removing the
RelicServer.urlproperty and using an expando in tests instead. It would be helpful to verify that this parameter renaming is properly coordinated with those changes:
🏁 Script executed:
#!/bin/bash # Look for places where the RelicServer.url property was previously used rg -A 2 -B 2 'server\.url' --type dart # Check if an expando is being used for the URL in tests as mentioned in the PR description rg -A 5 'Expando' --type dartLength of output: 1955
Parameter naming and coordinated URL changes verified successfully
The renaming from
parseAllHeaderstoeagerHeaderParsingis consistent across the tests, and our review of the repository confirms that the PR’s objective to remove theRelicServer.urlproperty is properly coordinated by using an Expando in tests (as shown intest/headers/headers_test_utils.dart). No further action is needed for this test.
- File affected:
test/headers/typed_headers/clear_site_data_header_test.dart(line 85)- Coordinated changes verified in:
test/headers/headers_test_utils.darttest/headers/typed_headers/access_control_allow_methods_header_test.dart (1)
68-68: Parameter name updated for improved clarity.The parameter renaming from
parseAllHeaderstoeagerHeaderParsingimproves code readability by more accurately describing the behavior: controlling whether headers are parsed immediately upon receipt (eagerly) or only when needed (lazily).test/headers/basic/access_control_allow_credentials_header_test.dart (1)
98-98: Parameter name updated for improved clarity.The parameter renaming from
parseAllHeaderstoeagerHeaderParsingimproves code readability by more accurately describing the behavior: controlling whether headers are parsed immediately upon receipt (eagerly) or only when needed (lazily).test/headers/typed_headers/accept_ranges_header_test.dart (1)
46-46: Parameter name updated for improved clarity.The parameter renaming from
parseAllHeaderstoeagerHeaderParsingimproves code readability by more accurately describing the behavior: controlling whether headers are parsed immediately upon receipt (eagerly) or only when needed (lazily).test/headers/typed_headers/range_header_test.dart (1)
89-89: Parameter name updated for improved clarity.The parameter renaming from
parseAllHeaderstoeagerHeaderParsingimproves code readability by more accurately describing the behavior: controlling whether headers are parsed immediately upon receipt (eagerly) or only when needed (lazily).test/headers/basic/max_forwards_header_test.dart (1)
91-91: Parameter name updated for clarity.The parameter name change from
parseAllHeaderstoeagerHeaderParsingbetter reflects the actual behavior of the parameter - controlling whether headers are parsed eagerly or lazily.test/headers/basic/access_control_max_age_header_test.dart (1)
69-69: Parameter renaming enhances API clarity.The parameter name change from
parseAllHeaderstoeagerHeaderParsingprovides better semantics about the parameter's purpose - controlling whether headers are parsed eagerly or lazily.test/headers/basic/expires_header_test.dart (1)
70-70: Parameter name updated for semantic clarity.The parameter name change from
parseAllHeaderstoeagerHeaderParsingbetter describes the behavior being tested - whether headers are parsed eagerly or only when accessed.test/headers/typed_headers/cookie_header_test.dart (1)
106-106: Parameter nameeagerHeaderParsingimproves code clarityThe renaming from
parseAllHeaderstoeagerHeaderParsingprovides a clearer description of what this parameter controls. This change is consistent with other files in the PR and better describes the intent - controlling whether headers are parsed eagerly or lazily.test/headers/basic/host_header_test.dart (1)
89-89: Parameter name change enhances readabilityThe renaming from
parseAllHeaderstoeagerHeaderParsingprovides better context about what the parameter controls. This is part of a consistent terminology change across the codebase to improve clarity.test/headers/basic/if_modified_since_header_test.dart (1)
70-70: Parameter rename improves semantic clarityChanging from
parseAllHeaderstoeagerHeaderParsingmakes the parameter's purpose clearer. This parameter controls whether headers are parsed immediately or on-demand, and the new name better reflects this behavior.test/headers/basic/date_header_test.dart (1)
70-70:Details
❓ Verification inconclusive
Consistent parameter renaming maintains codebase coherence
The parameter name change from
parseAllHeaderstoeagerHeaderParsingaligns with changes in other test files. This consistent naming convention across the codebase makes the code more maintainable and easier to understand.
🏁 Script executed:
#!/bin/bash # Check for any remaining instances of the old parameter name to ensure complete refactoring echo "Checking for any remaining instances of parseAllHeaders parameter..." rg "parseAllHeaders:" --type dartLength of output: 180
Refactoring Verification: EagerHeaderParsing Parameter
The parameter was successfully renamed from
parseAllHeaderstoeagerHeaderParsingin the test file (test/headers/basic/date_header_test.dartat line 70), and the search for any remaining instances ofparseAllHeaders:produced no matches. However, since the search command’s output was minimal and might benefit from manual confirmation, please verify across the entire codebase to ensure full consistency.
- File:
test/headers/basic/date_header_test.dart- Line: 70 (
eagerHeaderParsing: false,)test/headers/typed_headers/if_match_header_test.dart (1)
90-90: Parameter renamed fromparseAllHeaderstoeagerHeaderParsing.The parameter has been renamed to more accurately reflect its purpose - controlling whether headers are parsed eagerly or lazily. This is consistent with the PR's goal of improving how the RelicServer handles URL determination and header processing.
test/headers/typed_headers/cross_origin_resource_policy_header_test.dart (1)
65-65: Parameter renamed fromparseAllHeaderstoeagerHeaderParsing.The rename provides better semantic clarity about the parameter's purpose - it controls when header validation happens rather than which headers are parsed. This aligns with the PR's focus on improving how RelicServer handles requests.
test/headers/basic/location_header_test.dart (1)
91-91: Parameter renamed fromparseAllHeaderstoeagerHeaderParsing.The parameter name change clarifies that this flag controls when header validation occurs (eagerly vs. lazily) rather than which headers are parsed. This is part of the consistent renaming across test files.
test/headers/basic/server_header_test.dart (1)
48-48: Parameter renamed fromparseAllHeaderstoeagerHeaderParsing.This parameter rename is consistent with changes in other test files and provides a more accurate description of the parameter's function - controlling whether headers are validated immediately or only when accessed.
test/headers/typed_headers/access_control_request_method_header_test.dart (1)
73-73: Parameter name updated to better reflect behavior.The change from
parseAllHeaderstoeagerHeaderParsingimproves code clarity by using a more descriptive name that better reflects the parameter's purpose. This aligns with the PR's goal of refactoring how theRelicServerhandles URL determination, with consistent parameter naming across multiple test files.test/headers/typed_headers/content_security_policy_header_test.dart (1)
46-46: Parameter name updated for consistency and clarity.The parameter has been renamed from
parseAllHeaderstoeagerHeaderParsing, which more accurately describes its function - controlling whether headers are parsed eagerly or lazily. This terminology update is consistent with the changes in other test files and improves code readability.test/headers/typed_headers/access_control_allow_origin_header_test.dart (1)
94-94: Parameter renamed for better semantic meaning.The parameter name change from
parseAllHeaderstoeagerHeaderParsingprovides better clarity about what the parameter controls - whether headers are parsed eagerly during request handling or deferred until needed. This is part of the broader refactoring that addresses theRelicServerURL determination issue.
SandPod
left a comment
There was a problem hiding this comment.
LGTM! 👍
Maybe we could use eagerParseHeaders instead? Feels more inline with lazyLoadPage and that pattern.
Rename the named argument parseAllHeader to eagerParseHeaders in getServerRequestHeaders
7b74b06 to
31d0f3c
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/headers/headers_test_utils.dart (1)
16-47: Well-designed extension for test URL handlingThis is a clean implementation of the test-only URL functionality that was previously part of the
RelicServerclass. The extension approach keeps testing concerns separate from production code, and theExpandois an appropriate choice to associate URLs with server instances without modifying the class itself.The
_inferUrl()method handles different types of addresses (loopback, IPv6, IPv4) appropriately, with clear logic for each case.This is a good example of using extensions to add test-only functionality without polluting the production API. Consider documenting this pattern in your team's testing guidelines if it's not already there.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (65)
test/headers/basic/access_control_allow_credentials_header_test.dart(1 hunks)test/headers/basic/access_control_max_age_header_test.dart(1 hunks)test/headers/basic/access_control_request_headers_heder_test.dart(1 hunks)test/headers/basic/age_header_test.dart(1 hunks)test/headers/basic/allow_header_test.dart(1 hunks)test/headers/basic/content_location_header_test.dart(1 hunks)test/headers/basic/date_header_test.dart(1 hunks)test/headers/basic/expires_header_test.dart(1 hunks)test/headers/basic/host_header_test.dart(1 hunks)test/headers/basic/if_modified_since_header_test.dart(1 hunks)test/headers/basic/if_unmodified_since_header_test.dart(1 hunks)test/headers/basic/last_modified_header.dart(1 hunks)test/headers/basic/location_header_test.dart(1 hunks)test/headers/basic/max_forwards_header_test.dart(1 hunks)test/headers/basic/origin_header_test.dart(1 hunks)test/headers/basic/referer_header_test.dart(1 hunks)test/headers/basic/server_header_test.dart(1 hunks)test/headers/basic/trailer_header_test.dart(1 hunks)test/headers/basic/user_agent_header_test.dart(1 hunks)test/headers/basic/via_header_test.dart(1 hunks)test/headers/headers_test_utils.dart(2 hunks)test/headers/typed_headers/accept_encoding_header_test.dart(1 hunks)test/headers/typed_headers/accept_header_test.dart(1 hunks)test/headers/typed_headers/accept_language_test.dart(1 hunks)test/headers/typed_headers/accept_ranges_header_test.dart(1 hunks)test/headers/typed_headers/access_control_allow_headers_header_test.dart(1 hunks)test/headers/typed_headers/access_control_allow_methods_header_test.dart(1 hunks)test/headers/typed_headers/access_control_allow_origin_header_test.dart(1 hunks)test/headers/typed_headers/access_control_expose_headers_header_test.dart(1 hunks)test/headers/typed_headers/access_control_request_method_header_test.dart(1 hunks)test/headers/typed_headers/authorization_header_test.dart(1 hunks)test/headers/typed_headers/cache_control_header_test.dart(1 hunks)test/headers/typed_headers/clear_site_data_header_test.dart(1 hunks)test/headers/typed_headers/connection_header_test.dart(1 hunks)test/headers/typed_headers/content_disposition_header_test.dart(1 hunks)test/headers/typed_headers/content_encoding_header_test.dart(1 hunks)test/headers/typed_headers/content_language_header_test.dart(1 hunks)test/headers/typed_headers/content_range_header_test.dart(1 hunks)test/headers/typed_headers/content_security_policy_header_test.dart(1 hunks)test/headers/typed_headers/cookie_header_test.dart(1 hunks)test/headers/typed_headers/cross_origin_embedder_policy_header_test.dart(1 hunks)test/headers/typed_headers/cross_origin_opener_policy_header_test.dart(1 hunks)test/headers/typed_headers/cross_origin_resource_policy_header_test.dart(1 hunks)test/headers/typed_headers/etag_header_test.dart(1 hunks)test/headers/typed_headers/expect_header_test.dart(1 hunks)test/headers/typed_headers/from_header_test.dart(1 hunks)test/headers/typed_headers/if_match_header_test.dart(1 hunks)test/headers/typed_headers/if_none_match_header_test.dart(1 hunks)test/headers/typed_headers/if_range_header_test.dart(1 hunks)test/headers/typed_headers/permissions_policy_header_test.dart(1 hunks)test/headers/typed_headers/proxy_authenticate_header_test.dart(1 hunks)test/headers/typed_headers/proxy_authorization_header_test.dart(1 hunks)test/headers/typed_headers/range_header_test.dart(1 hunks)test/headers/typed_headers/referrer_policy_header_test.dart(1 hunks)test/headers/typed_headers/retry_after_header_test.dart(1 hunks)test/headers/typed_headers/sec_fetch_dest_header_test.dart(1 hunks)test/headers/typed_headers/sec_fetch_mode_header_test.dart(1 hunks)test/headers/typed_headers/sec_fetch_site_header_test.dart(1 hunks)test/headers/typed_headers/set_cookie_header_test.dart(1 hunks)test/headers/typed_headers/strict_transport_security_header_test.dart(1 hunks)test/headers/typed_headers/te_header_test.dart(1 hunks)test/headers/typed_headers/transfer_encoding_header_test.dart(1 hunks)test/headers/typed_headers/upgrade_header_test.dart(1 hunks)test/headers/typed_headers/vary_header_test.dart(1 hunks)test/headers/typed_headers/www_authenticate_header_test.dart(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (64)
- test/headers/typed_headers/expect_header_test.dart
- test/headers/typed_headers/sec_fetch_dest_header_test.dart
- test/headers/typed_headers/cross_origin_embedder_policy_header_test.dart
- test/headers/typed_headers/sec_fetch_mode_header_test.dart
- test/headers/typed_headers/content_language_header_test.dart
- test/headers/typed_headers/etag_header_test.dart
- test/headers/basic/via_header_test.dart
- test/headers/typed_headers/accept_header_test.dart
- test/headers/typed_headers/proxy_authenticate_header_test.dart
- test/headers/typed_headers/transfer_encoding_header_test.dart
- test/headers/typed_headers/access_control_allow_headers_header_test.dart
- test/headers/basic/trailer_header_test.dart
- test/headers/basic/allow_header_test.dart
- test/headers/typed_headers/from_header_test.dart
- test/headers/basic/if_unmodified_since_header_test.dart
- test/headers/typed_headers/access_control_expose_headers_header_test.dart
- test/headers/typed_headers/retry_after_header_test.dart
- test/headers/typed_headers/cross_origin_opener_policy_header_test.dart
- test/headers/basic/content_location_header_test.dart
- test/headers/typed_headers/if_none_match_header_test.dart
- test/headers/basic/origin_header_test.dart
- test/headers/typed_headers/strict_transport_security_header_test.dart
- test/headers/typed_headers/content_disposition_header_test.dart
- test/headers/typed_headers/if_range_header_test.dart
- test/headers/typed_headers/accept_encoding_header_test.dart
- test/headers/typed_headers/sec_fetch_site_header_test.dart
- test/headers/typed_headers/if_match_header_test.dart
- test/headers/basic/age_header_test.dart
- test/headers/typed_headers/permissions_policy_header_test.dart
- test/headers/basic/access_control_allow_credentials_header_test.dart
- test/headers/typed_headers/content_range_header_test.dart
- test/headers/typed_headers/accept_language_test.dart
- test/headers/typed_headers/set_cookie_header_test.dart
- test/headers/typed_headers/authorization_header_test.dart
- test/headers/typed_headers/www_authenticate_header_test.dart
- test/headers/typed_headers/upgrade_header_test.dart
- test/headers/typed_headers/accept_ranges_header_test.dart
- test/headers/basic/referer_header_test.dart
- test/headers/typed_headers/proxy_authorization_header_test.dart
- test/headers/typed_headers/content_security_policy_header_test.dart
- test/headers/basic/last_modified_header.dart
- test/headers/typed_headers/cookie_header_test.dart
- test/headers/typed_headers/te_header_test.dart
- test/headers/typed_headers/cache_control_header_test.dart
- test/headers/basic/expires_header_test.dart
- test/headers/basic/if_modified_since_header_test.dart
- test/headers/typed_headers/referrer_policy_header_test.dart
- test/headers/basic/max_forwards_header_test.dart
- test/headers/basic/date_header_test.dart
- test/headers/typed_headers/access_control_allow_methods_header_test.dart
- test/headers/basic/access_control_max_age_header_test.dart
- test/headers/typed_headers/vary_header_test.dart
- test/headers/typed_headers/clear_site_data_header_test.dart
- test/headers/typed_headers/range_header_test.dart
- test/headers/typed_headers/connection_header_test.dart
- test/headers/basic/server_header_test.dart
- test/headers/typed_headers/content_encoding_header_test.dart
- test/headers/basic/user_agent_header_test.dart
- test/headers/typed_headers/access_control_allow_origin_header_test.dart
- test/headers/typed_headers/access_control_request_method_header_test.dart
- test/headers/basic/access_control_request_headers_heder_test.dart
- test/headers/basic/location_header_test.dart
- test/headers/typed_headers/cross_origin_resource_policy_header_test.dart
- test/headers/basic/host_header_test.dart
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Run Unit Tests (macos-latest, 3.3.0)
🔇 Additional comments (3)
test/headers/headers_test_utils.dart (3)
56-57: Correctly addedawaitto async return statementsAdding
awaitensures proper asynchronous behavior when creating the server. This is a good practice that prevents potential timing issues.Also applies to: 62-63
76-76: Parameter renaming fromparseAllHeaderstoeagerParseHeadersAs discussed in previous reviews, this renaming improves clarity by better reflecting the purpose of the parameter. The code now consistently uses the new name throughout the function.
Also applies to: 84-84
92-92:Details
✅ Verification successful
Verify that all usages of
server.urlare updatedNow that the
urlproperty has been moved fromRelicServerto the test extension, ensure that all test files importingRelicServerdirectly (without this utility file) are updated accordingly.
🏁 Script executed:
#!/bin/bash # Find all references to 'server.url' throughout the test files # excluding the headers_test_utils.dart file we're currently reviewing echo "Searching for all references to 'server.url' in test files..." rg "server\.url" --type dart test/ -g "!test/headers/headers_test_utils.dart" # Check if any test files import RelicServer directly without also importing the test utils echo -e "\nChecking for test files that might need to import the extension:" FILES_USING_RELIC_SERVER=$(rg -l "import.*RelicServer" --type dart test/) for FILE in $FILES_USING_RELIC_SERVER; do if [[ "$FILE" != "test/headers/headers_test_utils.dart" ]]; then if ! grep -q "import.*headers_test_utils.dart" "$FILE"; then echo "- $FILE imports RelicServer but not headers_test_utils.dart" fi fi doneLength of output: 708
Review Update: All
server.urlUsages Are Now Consistent
- The search confirms that the only references to
server.urloutside oftest/headers/headers_test_utils.dartare intest/relic_server_test.dart.- No test files were found to import
RelicServerdirectly without using the test utilities.- Please verify that
test/relic_server_test.dart(and any similar files) import the test extension (viaheaders_test_utils.dart) so that they correctly access the relocatedurlproperty.
Description
In general a server cannot know what URL can/will be used to contact it until it sees an actual request. Previously
RelicServerhad anurlproperty, which was used in the tests to know what URL to contact to hit it.Pre-Launch Checklist
Please ensure that your PR meets the following requirements before submitting:
- I have referenced at least one issue this PR fixes or is related to.///), ensuring consistency with existing project documentation.- I have added new tests to verify the changes.Breaking Changes
RelicServer.url property removed
Additional Notes
Include any additional information or context about the PR here, if needed.
Summary by CodeRabbit
Refactor
RelicServer.Tests
eagerParseHeadersfor improved clarity and consistency in header parsing behavior.