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



100
101
102
103
104
105
# File 'lib/restclient/payload.rb', line 100

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



107
108
109
# File 'lib/restclient/payload.rb', line 107

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