Repository navigation
Conversation
Responses from get, post, put and doRequest now carry the URL that answered the request, after any redirects. Failed requests resolve with status -1 and an empty url. Changelog-Added: `url` property on `hs.http` responses, giving the final URL after any redirects
Contributor
[Medium impact] The PR appears safe to merge. SummaryAdds the final response URL to
No actionable issues found. The macOS tests were not run in this Linux environment. Reviews (1) · Last reviewed commit: "feat(hs.http): include the final URL in ..." · Reviewed by Greptile |
This branch has not been deployed
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.
Summary
Every
hs.httprequest (get,post,put,doRequest) now resolves with aurlproperty alongsidestatus,bodyandheaders:urlis the URL that actually answered the request, so after a redirect it differs from the one that was requested. This is useful for resolving short links and detecting redirects without handling them yourself.Behaviour
urlis the final URL after any redirects.statusis-1as before, andurlis"".Like the other fields, it is always present, so callers don't need to check for
undefined.status,bodyandheadersare unchanged.Changes
HSHTTPModule.swift: readHTTPURLResponse.urland add it to the resolved object;update the
Returns:docstrings for all four request methods.docs/migration-guide.md: thehs.httpentry now documentsurl.Tests
Both are loopback only, with no external network.
hs.httpserveranswers/startwith a 302 to/final. The test checks thaturlis the/finalURL andstatusis 200.status == -1andurl == "".Tests and
npm run docs:testpass locally.AI disclosure
Tool: Claude Code (Claude Sonnet 5.5), run in VS Code.
urlchange inHSHTTPModule.swift(the module's response handling).Changelog-Added:
urlproperty onhs.httpresponses, giving the final URL after any redirects