Repository navigation
Conversation
cupertino_http and cronet_http follow redirects natively and expose the final URL through BaseResponseWithUrl, but ConversionLayerAdapter never passed it on, so Response.realUri stayed the request URL and Response.redirects was always empty. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2631
cupertino_httpandcronet_httpfollow redirects natively and expose the final URL throughBaseResponseWithUrl, butConversionLayerAdapternever passed it on. So withNativeAdapter,Response.realUristayed the request URL andResponse.redirectswas always empty after a redirect.This adds a single
RedirectRecordwith the final URL when it differs from the request URL. The native clients don't expose the intermediate hops or their status codes, so the record uses302and the request method. That's enough forrealUrito be right, butredirectswon't list every hop likeIOHttpClientAdapterdoes. Happy to change the status code if you'd prefer something else.@cfug/dio-core this touches redirect handling, so flagging it as the guidelines ask.
Added three tests to
conversion_layer_adapter_test.dart: a redirected response (fails without the change), a response whose URL didn't change, and a response that doesn't report a URL.flutter testanddart analyzeinplugins/native_dio_adapterpass.Unverified: I didn't run it against a real redirect on a device.
Implementation and tests written with Claude Code; I reviewed and ran them.
New Pull Request Checklist
mainbranch to avoid conflicts (via merge from master or rebase)CHANGELOG.mdin the corresponding package