Description
Change Intent
Currently, HttpClient
throws a StateError
when the server responds with a 302 but there is no Location
header.
Instead, RedirectException
(a subclass of HttpException
) should be thrown.
See #53158
Justification
StateError
should be thrown in response to programmer errors, not errors external to the application. Also, HttpException
subclasses are thrown in response to other HTTP protocol errors.
Some users (e.g. package:http
) assume that HttpClient
will only throw SocketException
or HttpException
.
Impact
This will break HTTP client code that catches StateError
but not HttpException
and interacts with HTTP servers that return 302 but don't include a Location
header. This seems unlikely to happen in practice.
Mitigation
It is likely that no actual code will need to be migrated. In the worst case, an exception type in a on
clause might need to change.
Change Timeline
N/A.
Associated CLs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status