Class: Net::HTTPRequest (Ruby 2.7.5)
Description: Class : Net::HTTPRequest - Ruby 2.7.5

### Home Classes Methods

### In Files

- net/http/request.rb

### Parent

Net::HTTPGenericRequest

### Methods

- ::new

### Class/Module Index

Quicksearch

- EXCEPTION_TYPE
- EXCEPTION_TYPE
- EXCEPTION_TYPE
- EXCEPTION_TYPE
- HTTPClientException
- HTTPGatewayTimeOut
- HTTPMovedTemporarily
- HTTPMultipleChoice
- HTTPRequestEntityTooLarge
- HTTPRequestTimeOut
- HTTPRequestURITooLarge
- HTTPRequestURITooLong
- HTTPRequestURITooLong
- HTTPRequestedRangeNotSatisfiable
- Net
- Net::HTTP
- Net::HTTP::Copy
- Net::HTTP::Delete
- Net::HTTP::Get
- Net::HTTP::Head
- Net::HTTP::Lock
- Net::HTTP::Mkcol
- Net::HTTP::Move
- Net::HTTP::Options
- Net::HTTP::Patch
- Net::HTTP::Post
- Net::HTTP::Propfind
- Net::HTTP::Proppatch
- Net::HTTP::Put
- Net::HTTP::Trace
- Net::HTTP::Unlock
- Net::HTTPAccepted
- Net::HTTPAlreadyReported
- Net::HTTPBadGateway
- Net::HTTPBadRequest
- Net::HTTPClientError
- Net::HTTPConflict
- Net::HTTPContinue
- Net::HTTPCreated
- Net::HTTPEarlyHints
- Net::HTTPError
- Net::HTTPExceptions
- Net::HTTPExpectationFailed
- Net::HTTPFailedDependency
- Net::HTTPFatalError
- Net::HTTPForbidden
- Net::HTTPFound
- Net::HTTPGatewayTimeout
- Net::HTTPGenericRequest
- Net::HTTPGone
- Net::HTTPHeader
- Net::HTTPIMUsed
- Net::HTTPInformation
- Net::HTTPInsufficientStorage
- Net::HTTPInternalServerError
- Net::HTTPLengthRequired
- Net::HTTPLocked
- Net::HTTPLoopDetected
- Net::HTTPMethodNotAllowed
- Net::HTTPMisdirectedRequest
- Net::HTTPMovedPermanently
- Net::HTTPMultiStatus
- Net::HTTPMultipleChoices
- Net::HTTPNetworkAuthenticationRequired
- Net::HTTPNoContent
- Net::HTTPNonAuthoritativeInformation
- Net::HTTPNotAcceptable
- Net::HTTPNotExtended
- Net::HTTPNotFound
- Net::HTTPNotImplemented
- Net::HTTPNotModified
- Net::HTTPOK
- Net::HTTPPartialContent
- Net::HTTPPayloadTooLarge
- Net::HTTPPaymentRequired
- Net::HTTPPermanentRedirect
- Net::HTTPPreconditionFailed
- Net::HTTPPreconditionRequired
- Net::HTTPProcessing
- Net::HTTPProxyAuthenticationRequired
- Net::HTTPRangeNotSatisfiable
- Net::HTTPRedirection
- Net::HTTPRequest
- Net::HTTPRequestHeaderFieldsTooLarge
- Net::HTTPRequestTimeout
- Net::HTTPResetContent
- Net::HTTPResponse
- Net::HTTPRetriableError
- Net::HTTPSeeOther
- Net::HTTPServerError
- Net::HTTPServerException
- Net::HTTPServiceUnavailable
- Net::HTTPSuccess
- Net::HTTPSwitchProtocol
- Net::HTTPTemporaryRedirect
- Net::HTTPTooManyRequests
- Net::HTTPURITooLong
- Net::HTTPUnauthorized
- Net::HTTPUnavailableForLegalReasons
- Net::HTTPUnknownResponse
- Net::HTTPUnprocessableEntity
- Net::HTTPUnsupportedMediaType
- Net::HTTPUpgradeRequired
- Net::HTTPUseProxy
- Net::HTTPVariantAlsoNegotiates
- Net::HTTPVersionNotSupported

No matching classes.

# Net::HTTPRequest

HTTP request class. This class wraps together the request header and the request path. You cannot use this class directly. Instead, you should use one of its subclasses: `Net::HTTP::Get`, `Net::HTTP::Post`, `Net::HTTP::Head`.

### Public Class Methods

new(path, initheader = nil) click to toggle source

Creates an HTTP request object for `path`.

`initheader` are the default headers to use. `Net::HTTP` adds Accept-Encoding to enable compression of the response body unless Accept-Encoding or Range are supplied in `initheader`.

                   # File net/http/request.rb, line 14
    def initialize(path, initheader = nil)
      super self.class::METHOD,
            self.class::REQUEST_HAS_BODY,
            self.class::RESPONSE_HAS_BODY,
            path, initheader
    end