Class: Faraday::Encoding
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::Encoding
- Defined in:
- lib/faraday/encoding.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.mappings ⇒ Object
5 6 7 8 9 |
# File 'lib/faraday/encoding.rb', line 5 def self.mappings { 'utf8' => 'utf-8' } end |
Instance Method Details
#call(environment) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/faraday/encoding.rb', line 11 def call(environment) @app.call(environment).on_complete do |env| @env = env if encoding = content_charset env[:body] = env[:body].dup if env[:body].frozen? env[:body].force_encoding(encoding) if !env[:body].nil? end end end |