Sha256: ae9c66666c8dd7f382e8a0b0cb80a237cb0a8d9dae8c3ea229ab3df12448cb1d
Contents?: true
Size: 620 Bytes
Versions: 27
Compression:
Stored size: 620 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_str def_delegator :@raw, :to_s def_delegator :@raw, :bytesize def_delegator :@raw, :force_encoding 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
27 entries across 27 versions & 1 rubygems