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

Constructor Details

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

Instance Method Details

#build_stream(params = nil) ⇒ Object



90
91
92
93
94
95
# File 'lib/restclient/payload.rb', line 90

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



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

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