Class: RestClient::Payload::UrlEncoded

Inherits:
Base
  • Object
show all
Defined in:
lib/restclient/payload.rb

Instance Method Summary collapse

Methods inherited from Base

#close, #escape, #flatten_params, #initialize, #inspect, #read, #short_inspect, #size

Constructor Details

This class inherits a constructor from RestClient::Payload::Base

Instance Method Details

#build_stream(params = nil) ⇒ Object


97
98
99
100
101
102
# File 'lib/restclient/payload.rb', line 97

def build_stream(params = nil)
  @stream = StringIO.new(flatten_params(params).map do |k, v|
    "#{k}=#{escape(v)}"
  end.join("&"))
  @stream.seek(0)
end

#headersObject


104
105
106
# File 'lib/restclient/payload.rb', line 104

def headers
  super.merge({ 'Content-Type' => 'application/x-www-form-urlencoded' })
end