class HTTP::Request

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.cr

Constructors

Class Method Summary

Instance Method Summary

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") #

[View source]
def self.new(method : String, resource : String, headers : Headers | Nil = nil, body : String | Bytes | IO | Nil = nil, version = "HTTP/1.1") #

[View source]

Class Method Detail

def self.get_host_from_text(text : String) #

[View source]
def self.get_port_from_text(text : String) : Int32 | Nil #

[View source]
def self.parse_port(text : String) #

[View source]

Instance Method Detail

def body=(body : Nil) #

[View source]
def compress_type : HTTP::CompressType | Nil #

[View source]
def connect? #

[View source]
def connect_host #

[View source]
def connect_port #

[View source]
def content_length #

[View source]
def encoding? : Bool #

[View source]
def header_host #

[View source]
def header_host=(value : String) #

[View source]
def header_keep_alive=(value : Bool) #

[View source]
def header_port #

[View source]
def regular_port #

[View source]
def serialize_headers_and_body(io) #

[View source]
def to_io(io, without_body : Bool) #

[View source]