# immutable-app-http-redirect

> Immutable app http redirect

Latest version **0.1.17** (published 2018-01-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install immutable-app-http-redirect
pnpm add immutable-app-http-redirect
yarn add immutable-app-http-redirect
bun add immutable-app-http-redirect
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.17 |
| Published | 2018-01-15 |
| First published | 2017-03-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=7.6.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ersun Warncke |
| Maintainers | ersun.warncke |

## Links

- npm: https://www.npmjs.com/package/immutable-app-http-redirect
- Repository: https://github.com/warncke/immutable-app-http-redirect
- Homepage: https://github.com/warncke/immutable-app-http-redirect#readme
- Issues: https://github.com/warncke/immutable-app-http-redirect/issues
- npm.io page: https://npm.io/package/immutable-app-http-redirect

## Recent versions

- 0.1.17 (latest) — 2018-01-15
- 0.1.16 — 2017-10-06
- 0.1.15 — 2017-10-04
- 0.1.14 — 2017-09-19
- 0.1.13 — 2017-09-10
- 0.1.12 — 2017-09-04
- 0.1.11 — 2017-08-05
- 0.1.10 — 2017-08-02
- 0.1.9 — 2017-07-27
- 0.1.8 — 2017-06-07
- 0.1.7 — 2017-06-06
- 0.1.6 — 2017-06-03
- 0.1.5 — 2017-06-02
- 0.1.4 — 2017-05-30
- 0.1.3 — 2017-05-25
- … 3 more at https://npm.io/package/immutable-app-http-redirect/versions

## README

# immutable-app-http-redirect

Throws an error object that will be used by the
[immutable-app](https://www.npmjs.com/package/immutable-app) framework to
generate an http redirect.

## Throwing a 302 redirect

    const httpRedirect = require('immutable-app-http-redirect')

    httpRedirect('/foo/bar')

By default http redirect will do a 302 (temporary) redirect to the given url.
If the URL is falsy '/' will be used as the default destination.

## Throwing a 301 redirect

    httpRedirect('/foo/bar', 301)

To do a 301 (permanent) redirect the 301 code must be passed as the second
argument.

## Throwing a redirect that sets cookies with response

    httpRedirect('/foo', 302, {foo: bar})

The cookies aregument must be an object. Each property will be used as the
cookie name and the value will be used to set/clear the cookie.

If the value is false the cookie is cleared.

If the value is a string the cookie will be set with default options.

If the value is an object the value property of the object will be used as the
cookie value and the rest of the properties will be used to set the cookie
options.

## Throwing a redirect that sets http headers with response

    httpRedirect('/foo', 302, null, {foo: bar})

The headers argument must be an object. The properties and values will be used
to set http headers for the response.

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