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


21
22
23
24
# File 'lib/httpx/transcoder/json.rb', line 21

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

Instance Method Details

#content_typeObject


26
27
28
# File 'lib/httpx/transcoder/json.rb', line 26

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