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, #flatten_params_array, #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



112
113
114
115
116
117
# File 'lib/restclient/payload.rb', line 112

def build_stream(params = nil)
  @stream = StringIO.new(flatten_params(params).collect do |entry|
    "#{entry[0]}=#{escape(entry[1])}"
  end.join("&"))
  @stream.seek(0)
end

#headersObject



119
120
121
# File 'lib/restclient/payload.rb', line 119

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