A declarative http client based off superagent. Versions available for both the browser and node with the same API and shared test suite.
npm install solicit
then in your app:
// => a whole lot of JSON
Each http verb has a corresponding helper function for making that type of request. Each function will return a
Request. Requests are deferred results so you are free to configure them as much as you like with the methods mentioned below then call
then() to actually send the request and read the response. The main verbs you will be using are:
deleteis a reserved word in JS)
val, or multiple fields with one object.
Get request header
Set the "Content-Type" header. Common
be set with a shorthand string:
Set the "Accept" header. As with
shorthand strings are allowed
Set timeout to
Clear previous timeout.
Abort and clear timeout.
Agent to use for this HTTP request.
The default (if this function is not called) is to
opt out of connection pooling (
data, defaulting the
.type() to "json" when
an object is given.
// manual jsontype'json'
// auto json
// manual x-www-form-urlencodedtype'form'
// auto x-www-form-urlencodedtype'form'
// string defaults to x-www-form-urlencoded
Set Authorization field value with
Set the max redirects to
Set the path.
arguments is joined to form the path:
data to the socket.
Pipe the request body to