Fix json >= 3.0 compatibility - #115
Merged
Merged
Conversation
Replace Faraday's built-in :json response middleware, which calls JSON.parse(body, options) positionally, with Strava::Web::JsonResponse, a subclass that calls JSON.parse(body) with a single argument. This works with both json < 3.0 and json >= 3.0, which made options keyword-only. Also uncomments the json-3 appraisal in CI now that it passes, and removes the json ~> 2.3 pin from the Gemfile since it's no longer needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Danger ReportNo issues found. |
Faraday 2.14.4 supports json 3 by forwarding parser options as\nkeyword arguments. Require that version and restore Faraday's built-in\n:json response middleware, removing the no-longer-needed local override.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #113.
Faraday v2.14.4 supports
jsongem 3.x by passing JSON parser options as keyword arguments. This PR requires Faraday >= 2.14.4 and continues to use Faraday's built-in:jsonresponse middleware, so no local middleware replacement is needed.The
json~> 2.3 development pin is removed, and thejson-3appraisal is enabled in CI.Testing
bundle exec rake specBUNDLE_GEMFILE=gemfiles/json_2.gemfile bundle exec rake specBUNDLE_GEMFILE=gemfiles/json_3.gemfile bundle exec rake spec