Move json middleware (request and response) from faraday_middleware#1300
Merged
Move json middleware (request and response) from faraday_middleware#1300
Conversation
Member
|
Ruby 3 seems to have some unwanted behaviour about arguments, is that around kwargs? |
Member
Author
|
It's the dependency loader, even adding |
Member
Author
|
I'm gonna finish this up once #1301 gets merged 👍 |
olleolleolle
reviewed
Aug 9, 2021
| self.headers = serialised[:headers] | ||
| self.path = serialised[:path] | ||
| self.params = serialised[:params] | ||
| self.options = serialised[:options] |
|
|
||
| def process_request?(env) | ||
| type = request_type(env) | ||
| body?(env) && (type.empty? || MIME_TYPE_REGEX =~ type) |
Member
There was a problem hiding this comment.
Ruby version question: Can we use #match? here?
| def process_response_type?(env) | ||
| type = response_type(env) | ||
| @content_types.empty? || @content_types.any? do |pattern| | ||
| pattern.is_a?(Regexp) ? type =~ pattern : type == pattern |
Member
There was a problem hiding this comment.
Here, perhaps too, an opportunity for #match?
| let(:options) { {} } | ||
| let(:headers) { {} } | ||
| let(:middleware) do | ||
| puts options |
Member
There was a problem hiding this comment.
This is debug output, perhaps it can be removed?
Co-authored-by: Olle Jonsson <[email protected]>
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
The JSON middleware, both request and response ones, are between the most used and require no external dependency since the
jsonmodule is part of Ruby.For this reason, we can safely move it inside Faraday.
Tests have also been moved and the Website documentation have been updated.
Todos
List any remaining work that needs to be done, i.e: