Method: Manticore::Client#post

Defined in:

#post(url, options = {}, &block) ⇒ Response

Perform a HTTP POST request


Simple usage

body ="", params: {foo: "bar"}, headers: {"X-Custom-Header" => "whee"}).body

Passing a block as the success handler:

body ="", params: {foo: "bar"}, headers: {"X-Custom-Header" => "whee"}) {|response| response.body }

Explicit success handler:

body ="", params: {foo: "bar"}, headers: {"X-Custom-Header" => "whee"}).
  on_success {|response| response.body }


  • url (String)

    URL to request

  • options (Hash) (defaults to: {})

Options Hash (options):

  • query (Hash)

    Hash of options to be added to the URL as part of the query string

  • params (Hash)

    Hash of options to pass as a request body. For GET, HEAD, and DELETE requests, :params will be treated as :query if :query is not present.

  • headers (Hash)

    Hash of options to pass as additional request headers

  • proxy (String)

    Proxy host in form:

  • proxy (Hash)

    Proxy host in form: ''[, port: 80[, scheme: 'http']]

  • proxy (URI)

    Proxy host as a URI object

  • connect_timeout (Float)

    Request-specific connect timeout (in seconds)

  • socket_timeout (Float)

    Request-specific socket timeout (in seconds)

  • request_timeout (Float)

    Request-specific request timeout (in seconds)

  • max_redirects (Integer)

    Request-specific maximum redirect limit

  • follow_redirects (Boolean)

    Specify whether this request should follow redirects

  • auth (Hash)

    Specify authentication for the request

  • auth[:user] (String)

    Username to auth with

  • auth[:password] (String)

    Password to auth with

  • auth[:eager] (Boolean)

    Eagerly offer the Authorization header before the server challenges for it. You should not use this unless you know you specifically need it, as misuse of it can leak user credentials.

  • body (String)

    Body to pass with the request



# File 'lib/manticore/client.rb', line 283

def post(url, options = {}, &block)
  request HttpPost, url, options, &block