Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add json middleware to 1.x #1400

Merged
merged 3 commits into from
Feb 17, 2022
Merged

Add json middleware to 1.x #1400

merged 3 commits into from
Feb 17, 2022

Conversation

iMacTia
Copy link
Member

@iMacTia iMacTia commented Feb 16, 2022

Description

Gems that rely on the json middleware have a hard time supporting both Faraday v1 and v2, because the json middleware is not bundled as an independent gem. It's included in v2, but it's only available via faraday_middleware for v1.
This causes the situation where a gem can't support both Faraday v1 and v2, as that will require a dependency on faraday_middleware, which will prevent the gem from being used with Faraday v2.

This PR backports the json middleware to Faraday v1 as well, so that gems can support both v1.10+ and v2

Todos

List any remaining work that needs to be done, i.e:

  • Tests
  • Documentation

Additional Notes

I've tested this locally for conflicts with faraday_middleware.
Things work even if faraday_middleware is added to the mix and required, but the middleware in there takes priority over the one bundled. I guess that's OK though

@iMacTia
Copy link
Member Author

iMacTia commented Feb 17, 2022

Merging this as it's pretty much the same as what we shipped with v2 👍

@iMacTia iMacTia merged commit 4a838a5 into 1.x Feb 17, 2022
@iMacTia iMacTia deleted the add-json-middleware-to-1.x branch February 17, 2022 09:44
Copy link

@calbearox calbearox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

mkmn added a commit to mkmn/mrkt that referenced this pull request Nov 24, 2022
faraday_middleware is deprecated, and does not support Faraday v2.
From v1.10.0, faraday is bundled json middleware, and this gem can support Faraday v2.

* Require Faraday v1.10 or higher
  * backport json middleware from this version.
  * ref. lostisland/faraday#1400
* require `faraday-multipart`
  * From Faraday v2, multipart middleware have been moved to separate faraday-multipart gem.
* Add CI matrix
  * Run tests on both versions of Faraday.
mkmn added a commit to mkmn/mrkt that referenced this pull request Nov 24, 2022
faraday_middleware is deprecated, and does not support Faraday v2.
From v1.10.0, faraday is bundled json middleware, and this gem can support Faraday v2.

* Require Ruby: v2.6 or higer
  * Faraday v2 required Ruby v2.6
* Require Faraday: v1.10 or higher
  * backport json middleware from this version.
  * ref. lostisland/faraday#1400
* require `faraday-multipart`
  * From Faraday v2, multipart middleware have been moved to separate faraday-multipart gem.
* Add CI matrix
  * Run tests on both versions of Faraday.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants