lostisland / faraday

Simple, but flexible HTTP client library, with support for multiple backends.
https://lostisland.github.io/faraday
MIT License
5.71k stars 972 forks source link

Add URL to to_hash in Faraday::Response (#1474) #1475

Closed aaronstillwell closed 1 year ago

aaronstillwell commented 1 year ago

Description

This PR adds the url to the to_hash method of Faraday::Response as discussed in #1474

Todos

Review, commentary & discussion

Additional Notes

The url is provided to the hash as-is, which means it'll still be a URI object.

See https://github.com/aaronstillwell/faraday/blob/29ac4eec651f367d4be57985297db20f10796f9d/lib/faraday/response.rb#L65

In the spec, we create a URI object to test with: https://github.com/aaronstillwell/faraday/blob/29ac4eec651f367d4be57985297db20f10796f9d/spec/faraday/response_spec.rb#L6-L9

We currently do not explicitly test that the deserialized object has a URI object (rather than the URL as a string), but manual inspection suggests this works as I'd expect as an end user (that we'd get the URI object back and not a string).

Is there any expectation that to_hash should not contain an actual URI object?