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

Remove direct struct subclassing #1491

Closed bdewater closed 1 year ago

bdewater commented 1 year ago

Description

This is a follow-up to https://github.com/lostisland/faraday/pull/1489 - I noticed I was still missing Faraday::Request#body= from Tapioca's generated definitions.

~Since it also overrides #[] and #[]= it was impossible to set Struct members, so refactored this to a PORO that mostly (but not exactly) looks like the struct it used to be.~ Edit: aliased the original member getter/setters so we can override #[] and #[]=. This retains methods inherited from Struct people might be relying on (like #== which is tested in Faraday via Marshal dump/load).

Also did Faraday::Adapter::Test::Stub while I was here for consistency.

olleolleolle commented 1 year ago

@bdewater Thanks for adding the context of the change, that makes a lot of sense.