class Sketchup::Http::Response
Http::Response objects allows you to get the response information from the server, you can only receive the Http::Response if you have attached a callback block when calling start from the Http::Request object.
@version SketchUp 2017
Public Instance Methods
body()
click to toggle source
Gets the http body that was received from the server as a string encoded using the charset provided in the Content-Type of the server response, if no charset is specified, ASCII-8BIT will be used.
@example
@request = Sketchup::Http::Request.new("http://localhost:8080") @request.start do |request, response| puts "body: " + response.body end
@return [String]
@version SketchUp 2017
# File lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb, line 27 def body end
headers()
click to toggle source
Returns the http headers that were sent by the server.
@example
@request = Sketchup::Http::Request.new("http://localhost:8080") @request.start do |request, response| response.headers.each do |key, value| puts "#{key}: #{value}" end end
@return [Hash]
@version SketchUp 2017
# File lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb, line 44 def headers end
status_code()
click to toggle source
Returns the HTTP response status code as defined in rfc2616.
@example
@request = Sketchup::Http::Request.new("http://localhost:8080") @request.start do |request, response| puts "http status code: #{response.status_code}" end
@return [int]
@version SketchUp 2017
# File lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb, line 59 def status_code end