class HTTP::Request
- HTTP::Request
- Reference
- Object
Overview
An HTTP request.
It serves both to perform requests by an HTTP::Client
and to
represent requests received by an HTTP::Server
.
A request always holds an IO
as a body.
When creating a request with a String
or Bytes
its body
will be a IO::Memory
wrapping these, and the Content-Length
header will be set appropriately.
NOTE To use Request
, you must explicitly import it with require "http/request"
Defined in:
wrench/http/request.crConstructors
- .new(method : String, resource : String, headers : Headers | Nil = nil, body : String | Bytes | IO | Nil = nil, expect_continue : Bool = false, version = "HTTP/1.1")
- .new(method : String, resource : String, headers : Headers | Nil = nil, body : String | Bytes | IO | Nil = nil, version = "HTTP/1.1")
Class Method Summary
- .get_host_from_text(text : String)
- .get_port_from_text(text : String) : Int32 | Nil
- .parse_port(text : String)
Instance Method Summary
- #body=(body : Nil)
- #compress_type : HTTP::CompressType | Nil
- #connect?
- #connect_host
- #connect_port
- #content_length
- #encoding? : Bool
- #header_host
- #header_host=(value : String)
- #header_keep_alive=(value : Bool)
- #header_port
- #regular_port
- #serialize_headers_and_body(io)
- #to_io(io, without_body : Bool)
Constructor Detail
def self.new(method : String, resource : String, headers : Headers | Nil = nil, body : String | Bytes | IO | Nil = nil, expect_continue : Bool = false, version = "HTTP/1.1")
#
def self.new(method : String, resource : String, headers : Headers | Nil = nil, body : String | Bytes | IO | Nil = nil, version = "HTTP/1.1")
#