HTTP.call

Anywhere

HTTP.call(method, url, [options], [asyncCallback])

import { HTTP } from 'meteor/http' Source

Perform an outbound HTTP request.

Arguments

method String

The HTTP method to use, such as "GET", "POST", or "HEAD".

url String

The URL to retrieve.

asyncCallback Function

Optional callback. If passed, the method runs asynchronously, instead of synchronously, and calls asyncCallback. On the client, this callback is required.

Options

content String

String to use as the HTTP request body.

data Object

JSON-able object to stringify and use as the HTTP request body. Overwrites content.

query String

Query string to go in the URL. Overwrites any query string in url.

params Object

Dictionary of request parameters to be encoded and placed in the URL (for GETs) or request body (for POSTs). If content or data is specified, params will always be placed in the URL.

auth String

HTTP basic authentication string of the form "username:password"

headers Object

Dictionary of strings, headers to add to the HTTP request.

timeout Number

Maximum time in milliseconds to wait for the request before failing. There is no timeout by default.

followRedirects Boolean

If true, transparently follow HTTP redirects. Cannot be set to false on the client. Default true.

npmRequestOptions Object

On the server, HTTP.call is implemented by using the npm request module. Any options in this object will be passed directly to the request invocation.

beforeSend Function

On the client, this will be called before the request is sent to allow for more direct manipulation of the underlying XMLHttpRequest object, which will be passed as the first argument. If the callback returns false, the request will be not be send.

doc_Meteor
2016-05-29 17:20:33
Comments
Leave a Comment

Please login to continue.