lib/async/rest/wrapper/url_encoded.rb in async-rest-0.14.0 vs lib/async/rest/wrapper/url_encoded.rb in async-rest-0.15.0

- old
+ new

@@ -1,16 +1,16 @@ # frozen_string_literal: true # Released under the MIT License. -# Copyright, 2019-2023, by Samuel Williams. +# Copyright, 2019-2024, by Samuel Williams. -require 'json' +require "json" -require 'protocol/http/body/wrapper' -require 'protocol/http/body/buffered' +require "protocol/http/body/wrapper" +require "protocol/http/body/buffered" -require_relative 'generic' +require_relative "generic" module Async module REST module Wrapper class URLEncoded < Generic @@ -25,14 +25,14 @@ def split(*arguments) @content_type.split end def prepare_request(request, payload) - request.headers['accept'] ||= @content_type + request.headers["accept"] ||= @content_type if payload - request.headers['content-type'] = @content_type + request.headers["content-type"] = @content_type request.body = ::Protocol::HTTP::Body::Buffered.new([ ::Protocol::HTTP::URL.encode(payload) ]) end @@ -43,10 +43,10 @@ ::Protocol::HTTP::URL.decode(super, symbolize_keys: true) end end def parser_for(response) - if content_type = response.headers['content-type'] + if content_type = response.headers["content-type"] if content_type.start_with? @content_type return Parser end end