# superagent-absolute

> Superagent with absolute URLs.

Latest version **1.0.1** (published 2017-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install superagent-absolute
pnpm add superagent-absolute
yarn add superagent-absolute
bun add superagent-absolute
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-02-25 |
| First published | 2017-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Gerard Rovira Sánchez |
| Maintainers | zurfyx |
| Keywords | superagent, absolute, prefix, url, test |

## Links

- npm: https://www.npmjs.com/package/superagent-absolute
- Repository: https://github.com/zurfyx/superagent-absolute
- Homepage: https://github.com/zurfyx/superagent-absolute#readme
- Issues: https://github.com/zurfyx/superagent-absolute/issues
- npm.io page: https://npm.io/package/superagent-absolute

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-02-25
- 1.0.0 — 2017-02-25

## README

# Superagent Absolute

> Superagent with default absolute URLs.

[![Build Status](https://travis-ci.org/zurfyx/superagent-absolute.svg?branch=master)](https://travis-ci.org/zurfyx/superagent-absolute)
[![npm version](https://badge.fury.io/js/superagent-absolute.svg)](https://badge.fury.io/js/superagent-absolute)

Tired of writing `http://localhost` in front of every [superagent](https://github.com/visionmedia/superagent) request?
With superagent absolute you'll only write it once per host in your whole environment.

## Install

```
npm install superagent-absolute
```

## Usage

```
var superagent = require('superagent');
var superagentAbsolute = require('superagent-absolute');

var agent = superagent.agent();
global.request = superagentAbsolute(agent)('http://localhost:3030');
```

## Example

```
const superagent = require('superagent');
const superagentAbsolute = require('superagent-absolute');

const agent = superagent.agent();
const request = superagentAbsolute(agent)('http://localhost:3030');

it('should should display "It works!"', (done) => {
  request
    .get('/')
    .end((err, res) => {
      expect(res.status).to.equal(200);
      expect(res.body).to.eql({ msg: 'It works!' });
      done();
    });
});
```

Requested absolute URLs must start with `/`, otherwise they will be treated as relative.


## License

MIT © [Gerard Rovira Sánchez](//zurfyx.com)

---
_Source: https://npm.io/package/superagent-absolute · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
