# addon-proxy

> Firefox addon-sdk module to modify incoming responses

Latest version **0.0.7** (published 2015-12-12) · GPL3 license · 0 weekly downloads

## Install

```sh
npm install addon-proxy
pnpm add addon-proxy
yarn add addon-proxy
bun add addon-proxy
```

## 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.0.7 |
| Published | 2015-12-12 |
| First published | 2015-11-06 |
| Weekly downloads | 0 |
| License | GPL3 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Riccardo Pelizzi |
| Maintainers | rpelizzi |
| Keywords | jetpack |

## Links

- npm: https://www.npmjs.com/package/addon-proxy
- Repository: https://github.com/BruceBerry/addon-proxy
- Issues: https://github.com/BruceBerry/addon-proxy/issues
- npm.io page: https://npm.io/package/addon-proxy

## Recent versions

- 0.0.7 (latest) — 2015-12-12
- 0.0.6 — 2015-12-11
- 0.0.5 — 2015-12-11
- 0.0.4 — 2015-11-09
- 0.0.3 — 2015-11-08
- 0.0.2 — 2015-11-06
- 0.0.1 — 2015-11-06

## README

# addon-proxy

Provides a clean API for Firefox addon-sdk extensions to modify incoming HTTP
responses. To begin modifying responses, just call `rewrite({...})` and pass an
object with the optional properties `html`, `js`, `other`.

In addition, the argument can have a `responses` property, which is a
shorthand to return pre-computed responses if the requested URL contains the
provided pattern (but note that the original request is still sent, and the
response maintains the original response's status code and headers).

## Usage

    var proxy = require("addon-proxy");
    
    proxy.rewrite({
      html: function(data, req) {
        return foo(data);
      },
      js: function(data, req) {
        // req is the nsIHttpChannel that is passed to nsIStreamListener's methods.
        if (req.URI.host === "localhost")
          return data;
        else
          return bar(data);
      },
      other: function(data, req) {
        // or don't pass it at all, default behavior is just `return data;`
        return data;
      },
      responses: {
        "fakefile.js": "alert(fake)",
        "mydir/myfile": file.read(path)
      }
    });

You can temporarily disable `html` and `js` transformations for a particular
response by appending `proxypass=true` to the URL querystring.

To keep the API simple, this is a caching proxy, i.e. it does not stream responses,
it only forwards data when the request has been fully downloaded from the server.

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