Class: RestClient::RawResponse

### Home Classes Methods

### In Files

- lib/restclient/raw_response.rb

### Parent

Object

### Methods

- ::new
- #size
- #to_s

### Included Modules

- RestClient::AbstractResponse

### Class/Module Index

Quicksearch

- RestClient
- RestClient::AbstractResponse
- RestClient::Exception
- RestClient::ExceptionWithResponse
- RestClient::Exceptions
- RestClient::MaxRedirectsReached
- RestClient::Payload
- RestClient::Payload::Base
- RestClient::Payload::Multipart
- RestClient::Payload::Streamed
- RestClient::Payload::UrlEncoded
- RestClient::Platform
- RestClient::RawResponse
- RestClient::Redirect
- RestClient::Request
- RestClient::Request::Redirect
- RestClient::Request::RequestFailed
- RestClient::RequestFailed
- RestClient::Resource
- RestClient::Response
- RestClient::ResponseForException
- RestClient::SSLCertificateNotVerified
- RestClient::ServerBrokeConnection
- RestClient::Windows
- RestClient::Windows::RootCerts
- RestClient::Windows::RootCerts::CERT_CONTEXT

No matching classes.

# RestClient::RawResponse

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.

### Attributes

file[R]
request[R]

### Public Class Methods

new(tempfile, net_http_res, args, request) click to toggle source

    # File lib/restclient/raw_response.rb, line 18
    def initialize(tempfile, net_http_res, args, request)
      @net_http_res = net_http_res
      @args = args
      @file = tempfile
      @request = request
    end

### Public Instance Methods

size() click to toggle source

    # File lib/restclient/raw_response.rb, line 30
    def size
      File.size file
    end

to_s() click to toggle source

    # File lib/restclient/raw_response.rb, line 25
    def to_s
      @file.open
      @file.read
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.