Skip to content

sheltonial/superagent

This branch is 933 commits behind ladjs/superagent:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

31514d8 · Feb 25, 2016
Dec 14, 2015
Aug 13, 2015
Feb 25, 2016
Feb 25, 2016
Apr 16, 2015
Feb 24, 2012
Jan 12, 2016
Feb 26, 2015
Dec 22, 2014
Jan 26, 2016
Jan 17, 2016
Dec 17, 2015
Feb 17, 2016
Nov 24, 2015
Apr 13, 2015
Jan 26, 2016

Repository files navigation

SuperAgent Build Status

Sauce Test Status

SuperAgent is a small progressive client-side HTTP request library, and Node.js module with the same API, sporting many high-level HTTP client features. View the docs.

super agent

Installation

node:

$ npm install superagent

component:

$ component install visionmedia/superagent

Works with browserify and should work with webpack

request
  .post('/api/pet')
  .send({ name: 'Manny', species: 'cat' })
  .set('X-API-Key', 'foobar')
  .set('Accept', 'application/json')
  .end(function(err, res){
    // Calling the end function will send the request
  });

Supported browsers

Tested browsers:

  • Latest Android
  • Latest Firefox
  • Latest Chrome
  • IE9 through latest
  • Latest iPhone
  • Latest Safari

Even though IE9 is supported, a polyfill window.btoa is needed to use basic auth.

Plugins

Superagent is easily extended via plugins.

var nocache = require('superagent-no-cache');
var request = require('superagent');
var prefix = require('superagent-prefix')('/static');

request
.get('/some-url')
.use(prefix) // Prefixes *only* this request
.use(nocache) // Prevents caching of *only* this request
.end(function(err, res){
    // Do something
});

Existing plugins:

Please prefix your plugin with superagent-* so that it can easily be found by others.

For superagent extensions such as couchdb and oauth visit the wiki.

Running node tests

Install dependencies:

$ npm install

Run em!

$ make test

Running browser tests

Install dependencies:

$ npm install

Start the test runner:

$ make test-browser-local

Visit http://localhost:4000/__zuul in your browser.

Edit tests and refresh your browser. You do not have to restart the test runner.

License

MIT

About

Ajax with less suck - (and node.js HTTP client to match)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.3%
  • Other 0.7%