class Async::REST::Wrapper::JSON
def initialize(content_type = APPLICATION_JSON)
def initialize(content_type = APPLICATION_JSON) @content_type = content_type end
def parser_for(response)
def parser_for(response) if content_type = response.headers["content-type"] if content_type.start_with? @content_type return Parser end end return super end
def prepare_request(request, payload)
def prepare_request(request, payload) request.headers["accept"] ||= @content_type if payload request.headers["content-type"] = @content_type request.body = ::Protocol::HTTP::Body::Buffered.new([ ::JSON.dump(payload) ]) end end
def split(*arguments)
def split(*arguments) @content_type.split end