Class: HTTPX::Transcoder::JSON::Encoder

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/httpx/transcoder/json.rb

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Encoder

Returns a new instance of Encoder.



32
33
34
35
# File 'lib/httpx/transcoder/json.rb', line 32

def initialize(json)
  @raw = JSON.json_dump(json)
  @charset = @raw.encoding.name.downcase
end

Instance Method Details

#content_typeObject



37
38
39
# File 'lib/httpx/transcoder/json.rb', line 37

def content_type
  "application/json; charset=#{@charset}"
end