@calvin_von/plugin-request-hijack

1.0.2 • Public • Published

plugin-request-hijack

A dalao-proxy for hijacking asynchronous requests to do more cool things. Mostly rewrite requests url to local dalao-proxy server.

only support dalao-proxy > 1.x

version

Usage

Install dalao-proxy cli first

npm install -g dalao-proxy

Install plugin

  • globally

    dalao-proxy plugin install -g @calvin_von/plugin-request-hijack
  • locally

    dalao-proxy plugin install -D @calvin_von/plugin-request-hijack

Add config

"requestHijack": {
    "enable": true,
    "prefix": "",
    "smartInfer": true,
    "rewrite": [
        { "from": "...", "to": "...", }
    ]
}

Start proxy

$ dalao-proxy start
...
> npm run start

Config

prefix

Add prefix for all rewrite urls.

smartInfer

If rewrite not provided, smartInfer set to true will auto infer rewrite config from proxyTable of base config.

rewrite

  • from: A string or RegExp string to match URLs
  • to: A string or RegExp replace string to rewrite URLs

more docs about dalao-proxy, see CalvinVon/dalao-proxy on Github.

Package Sidebar

Install

npm i @calvin_von/plugin-request-hijack

Weekly Downloads

4

Version

1.0.2

License

ISC

Unpacked Size

8.11 kB

Total Files

7

Last publish

Collaborators

  • calvin_von