class Faraday::Request::Json
Request
middleware that encodes the body as JSON.
Processes only requests with matching Content-type or those without a type. If a request doesn’t have a type but has a body, it sets the Content-type to JSON MIME-type.
Doesn’t try to encode bodies that already are in string form.
Constants
- MIME_TYPE
- MIME_TYPE_REGEX
Public Instance Methods
# File lib/faraday/request/json.rb, line 18 def on_request(env) match_content_type(env) do |data| env[:body] = encode(data) end end