Sha256: 2ee7049dec3c53c155c473ee30865ca0bf5b9aa3ab843b9a47ce843dcd41d724

Contents?: true

Size: 863 Bytes

Versions: 10

Compression:

Stored size: 863 Bytes

Contents

require "json"

module HTTParty #:nodoc:
  
  class Response < HTTParty::BasicObject #:nodoc:
    def ok?
      [200, 201, 202].include?(self.code)
    end
  end
  
  class Request #:nodoc:
    
    private
    
    def body
      options[:body].is_a?(Hash) ? options[:body].to_json : options[:body]
    end
    
    def setup_raw_request
      # This is a cloudapp hack to ensure the correct headers are set on redirect from S3
      if @redirect
        options[:headers] = CloudApp::HEADERS
        options[:query] = {}
        options[:body] = {}
      end
      @raw_request = http_method.new(uri.request_uri)
      @raw_request.body = body if body
      @raw_request.initialize_http_header(options[:headers])
      @raw_request.basic_auth(username, password) if options[:basic_auth]
      setup_digest_auth if options[:digest_auth]
    end
    
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cloudapp_api-0.4.0 lib/cloudapp/httparty.rb
cloudapp_api-0.3.3 lib/cloudapp/httparty.rb
cloudapp_api-0.3.2 lib/cloudapp/httparty.rb
cloudapp_api-0.3.1 lib/cloudapp/httparty.rb
cloudapp_api-0.3.0 lib/cloudapp/httparty.rb
cloudapp_api-0.2.2 lib/cloudapp/httparty.rb
cloudapp_api-0.2.1 lib/cloudapp/httparty.rb
cloudapp_api-0.2.0 lib/cloudapp/httparty.rb
cloudapp_api-0.1.1 lib/cloudapp/httparty.rb
cloudapp_api-0.1.0 lib/cloudapp/httparty.rb