Add HTTP protocol version to response extra field #2466
+47
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Exposes the HTTP protocol version (1.0, 1.1, 2.0) in
Response.extrafor telemetry/observability use cases like OTEL.Changes
dio/lib/src/adapter.dart: AddhttpVersionKeyconstant for accessing protocol version fromResponse.extradio/lib/src/adapters/io_adapter.dart: ExtractprotocolVersionfrom internal_HttpHeadersvia dynamic access (not in public API), with graceful fallback for mock environmentsplugins/http2_adapter/lib/src/http2_adapter.dart: SethttpVersionKey = '2.0'for HTTP/2 connectionsUsage
Note: Web platform (
BrowserHttpClientAdapter) does not expose protocol version viaXMLHttpRequest.New Pull Request Checklist
mainbranch to avoid conflicts (via merge from master or rebase)CHANGELOG.mdin the corresponding packageAdditional context and info (if any)
Closes #2298. The
protocolVersionproperty exists on Dart's internal_HttpHeadersclass but is not exposed in the publicHttpHeadersinterface, requiring dynamic access.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.