Sha256: 9962905199a8a8c130ae7c598eded3be9389e1034b93a55ade8027f8a957d230
Contents?: true
Size: 540 Bytes
Versions: 24
Compression:
Stored size: 540 Bytes
Contents
# frozen_string_literal: true require "forwardable" require "json" module HTTPX::Transcoder module JSON module_function class Encoder extend Forwardable def_delegator :@raw, :to_s def_delegator :@raw, :bytesize def initialize(json) @raw = ::JSON.dump(json) @charset = @raw.encoding.name.downcase end def content_type "application/json; charset=#{@charset}" end end def encode(json) Encoder.new(json) end end register "json", JSON end
Version data entries
24 entries across 24 versions & 1 rubygems
Version | Path |
---|---|
httpx-0.11.0 | lib/httpx/transcoder/json.rb |
httpx-0.10.2 | lib/httpx/transcoder/json.rb |
httpx-0.10.1 | lib/httpx/transcoder/json.rb |
httpx-0.10.0 | lib/httpx/transcoder/json.rb |