class Crest::Request

Overview

A class that used to make the requests The result of a Crest::Request is a Crest::Response object.

Simple example:

request = Crest::Request.new(:post, "http://httpbin.org/post", {"age" => 27}, params: {:name => "Kurt"})
request.execute

Crest::Request.execute(:post, "http://httpbin.org/post", {"age" => 27}, json: true)

Crest::Request.post("http://httpbin.org/post", {"age" => 27}, json: true)

Block style:

request = Crest::Request.new(:get, "http://httpbin.org/get") do |request|
  request.headers.add("foo", "bar")
  request.user = "username"
  request.password = "password"
end

response = request.execute

Mandatory parameters:

Optional parameters:

Defined in:

lib/crest/src/crest/request.cr
ext/crest.cr

Constructors

Constructor Detail

def self.new(method : Symbol, url : String, form = {} of String => String, **args) #

When block is not given.


[View source]