Configurable JSON backend #1454
Replies: 4 comments 2 replies
-
👋 I turned this from an Issue into a Discussion, as this seemed more appropriate. Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
I think it's OK to inherit another middleware as Faraday Multipart does. Also, I think it makes sense with the first solution. For example, Faraday's built-in Logger middleware has an option to receive a user-specified logger here. faraday/lib/faraday/response/logger.rb Line 15 in 36916f0 I prefer the first one, but it seems to require a lot of work for it. |
Beta Was this translation helpful? Give feedback.
-
I just want to add to @yykamei answer a few thoughts at the maintainer:
|
Beta Was this translation helpful? Give feedback.
-
@kirillkaiumov I'm happy to say a contribution was just merged that makes JSON encoders/decoders configurable, which I believe is what you were after 😄 I'll release it soon in a new minor version 👍 |
Beta Was this translation helpful? Give feedback.
-
Currently
faraday
provides a middleware to encode/decode JSON payloads. Internally it usesjson
that from the Ruby's standard library. If I want to use another JSON backend like oj then I need to implement my own middleware. So, I have a few questions:oj
, can I make it inherit fromFaraday::Response::Json
class? Or it's considered "private" and better to inherit fromFaraday::Middleware
?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions