Sha256: 4a46a0cb27eeef7b474f1763844c4a67f02fa4041269f46bbba39875b8857000

Contents?: true

Size: 798 Bytes

Versions: 33

Compression:

Stored size: 798 Bytes

Contents

require File.dirname(__FILE__) + '/mixin/response'

module RestClient
	# The response from RestClient on a raw request looks like a string, but is 
	# actually one of these.  99% of the time you're making a rest call all you 
	# care about is the body, but on the occassion you want to fetch the 
	# headers you can:
	#
	#   RestClient.get('http://example.com').headers[:content_type]
	#
	# In addition, if you do not use the response as a string, you can access
	# a Tempfile object at res.file, which contains the path to the raw 
	# downloaded request body.  
	class RawResponse 
		include RestClient::Mixin::Response

		attr_reader :file

		def initialize(tempfile, net_http_res)
			@net_http_res = net_http_res
			@file = tempfile
		end

		def to_s
			@file.open
			@file.read
		end

	end
end

Version data entries

33 entries across 33 versions & 12 rubygems

Version Path
adamwiggins-rest-client-1.0.2 lib/restclient/raw_response.rb
adamwiggins-rest-client-1.0.3 lib/restclient/raw_response.rb
adamwiggins-rest-client-1.0.4 lib/restclient/raw_response.rb
auser-poolparty-1.2.10 vendor/gems/rest-client/lib/restclient/raw_response.rb
auser-poolparty-1.2.3 vendor/gems/rest-client/lib/restclient/raw_response.rb
auser-poolparty-1.2.4 vendor/gems/rest-client/lib/restclient/raw_response.rb
auser-poolparty-1.2.7 vendor/gems/rest-client/lib/restclient/raw_response.rb
auser-poolparty-1.2.8 vendor/gems/rest-client/lib/restclient/raw_response.rb
auser-poolparty-1.2.9 vendor/gems/rest-client/lib/restclient/raw_response.rb
auser-rest-client-1.0.1 lib/restclient/raw_response.rb
benschwarz-smoke-0.5.0 vendor/rest-client/lib/restclient/raw_response.rb
benschwarz-smoke-0.5.1 vendor/rest-client/lib/restclient/raw_response.rb
benschwarz-smoke-0.5.2 vendor/rest-client-1.0.1/lib/restclient/raw_response.rb
benschwarz-smoke-0.5.3 vendor/rest-client-1.0.1/lib/restclient/raw_response.rb
benschwarz-smoke-0.5.4 vendor/rest-client-1.0.1/lib/restclient/raw_response.rb
benschwarz-smoke-0.5.5 vendor/rest-client-1.0.1/lib/restclient/raw_response.rb
benschwarz-smoke-0.5.6 vendor/rest-client-1.0.1/lib/restclient/raw_response.rb
benschwarz-smoke-0.5.7 vendor/gems/gems/rest-client-1.0.1/lib/restclient/raw_response.rb
francois-rest-client-1.1.5 lib/restclient/raw_response.rb
francois-rest-client-1.1.6 lib/restclient/raw_response.rb