lostisland / faraday

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

Configurable JSON backend #1453

Closed kirillkaiumov closed 1 year ago

kirillkaiumov commented 1 year ago

Currently faraday provides a middleware to encode/decode JSON payloads. Internally it uses json 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:

  1. Do you think it's a good idea to allow configuring the built-in middleware to work with different JSON backends?
  2. If I want to make my own middleware to use oj, can I make it inherit from Faraday::Response::Json class? Or it's considered "private" and better to inherit from Faraday::Middleware?

Thanks!