-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
104 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ jobs: | |
- uses: actions/checkout@v2 | ||
- uses: denolib/setup-deno@v2 | ||
with: | ||
deno-version: 1.25.0 | ||
deno-version: 1.40.2 | ||
- run: deno install -A -f --unstable -n eggs https://x.nest.land/[email protected]/eggs.ts | ||
- run: | | ||
export PATH="/home/runner/.deno/bin:$PATH" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ ci: | |
@make test | ||
|
||
deps: | ||
@npm install -g typescript [email protected] | ||
@npm install -g typescript@4 [email protected] | ||
|
||
doc: | ||
@deno doc ./mod.ts | ||
|
@@ -23,7 +23,7 @@ fmt-check: | |
@deno fmt --check ${FILES_TO_FORMAT} | ||
|
||
lint: | ||
@deno lint --unstable ${FILES_TO_FORMAT} | ||
@deno lint ${FILES_TO_FORMAT} | ||
|
||
precommit: | ||
@make typedoc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ Proxy middleware for Deno Oak HTTP servers. | |
</p> | ||
|
||
```ts | ||
import { proxy } from "https://deno.land/x/oak_http_proxy@2.1.0/mod.ts"; | ||
import { proxy } from "https://deno.land/x/oak_http_proxy@2.2.0/mod.ts"; | ||
import { Application } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
const app = new Application(); | ||
|
@@ -32,13 +32,13 @@ Before importing, [download and install Deno](https://deno.land/#installation). | |
You can then import oak-http-proxy straight into your project: | ||
|
||
```ts | ||
import { proxy } from "https://deno.land/x/oak_http_proxy@2.1.0/mod.ts"; | ||
import { proxy } from "https://deno.land/x/oak_http_proxy@2.2.0/mod.ts"; | ||
``` | ||
|
||
oak-http-proxy is also available on [nest.land](https://nest.land/package/oak-http-proxy), a package registry for Deno on the Blockchain. | ||
|
||
```ts | ||
import { proxy } from "https://x.nest.land/oak-http-proxy@2.1.0/mod.ts"; | ||
import { proxy } from "https://x.nest.land/oak-http-proxy@2.2.0/mod.ts"; | ||
``` | ||
|
||
## Docs | ||
|
@@ -59,7 +59,10 @@ router.get("/string", proxy("http://google.com")); | |
|
||
router.get("/url", proxy(new URL("http://google.com"))); | ||
|
||
router.get("/function", proxy((ctx) => new URL("http://google.com"))); | ||
router.get( | ||
"/function", | ||
proxy((ctx) => new URL("http://google.com")) | ||
); | ||
``` | ||
|
||
Note: Unmatched path segments of the incoming request url _are not_ transferred to the outbound proxy URL. For dynamic proxy urls use the function form. | ||
|
@@ -241,7 +244,7 @@ app.use( | |
return; | ||
} | ||
default: { | ||
ctx.throw(err) | ||
ctx.throw(err); | ||
} | ||
} | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
export { STATUS_TEXT } from "https://deno.land/std@0.153.0/http/http_status.ts"; | ||
export { createState } from "https://deno.land/x/opineHttpProxy@3.0.2/src/createState.ts"; | ||
export { STATUS_TEXT } from "https://deno.land/std@0.213.0/http/status.ts"; | ||
export { createState } from "https://deno.land/x/opineHttpProxy@3.1.0/src/createState.ts"; | ||
export type { | ||
ProxyState, | ||
ProxyUrlFunction, | ||
} from "https://deno.land/x/opineHttpProxy@3.0.2/src/createState.ts"; | ||
export type { ProxyOptions } from "https://deno.land/x/opineHttpProxy@3.0.2/src/resolveOptions.ts"; | ||
export { isUnset } from "https://deno.land/x/opineHttpProxy@3.0.2/src/isUnset.ts"; | ||
export { decorateProxyReqUrl } from "https://deno.land/x/opineHttpProxy@3.0.2/src/steps/decorateProxyReqUrl.ts"; | ||
export { decorateProxyReqInit } from "https://deno.land/x/opineHttpProxy@3.0.2/src/steps/decorateProxyReqInit.ts"; | ||
export { prepareProxyReq } from "https://deno.land/x/opineHttpProxy@3.0.2/src/steps/prepareProxyReq.ts"; | ||
export { sendProxyReq } from "https://deno.land/x/opineHttpProxy@3.0.2/src/steps/sendProxyReq.ts"; | ||
export { filterProxyRes } from "https://deno.land/x/opineHttpProxy@3.0.2/src/steps/filterProxyRes.ts"; | ||
export { decorateSrcResHeaders } from "https://deno.land/x/opineHttpProxy@3.0.2/src/steps/decorateSrcResHeaders.ts"; | ||
export { decorateSrcRes } from "https://deno.land/x/opineHttpProxy@3.0.2/src/steps/decorateSrcRes.ts"; | ||
} from "https://deno.land/x/opineHttpProxy@3.1.0/src/createState.ts"; | ||
export type { ProxyOptions } from "https://deno.land/x/opineHttpProxy@3.1.0/src/resolveOptions.ts"; | ||
export { isUnset } from "https://deno.land/x/opineHttpProxy@3.1.0/src/isUnset.ts"; | ||
export { decorateProxyReqUrl } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/decorateProxyReqUrl.ts"; | ||
export { decorateProxyReqInit } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/decorateProxyReqInit.ts"; | ||
export { prepareProxyReq } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/prepareProxyReq.ts"; | ||
export { sendProxyReq } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/sendProxyReq.ts"; | ||
export { filterProxyRes } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/filterProxyRes.ts"; | ||
export { decorateSrcResHeaders } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/decorateSrcResHeaders.ts"; | ||
export { decorateSrcRes } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/decorateSrcRes.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,7 +74,7 @@ <h1>oak-http-proxy</h1> | |
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/oak_http_proxy/mod.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fupdates%2Fx%2Foak_http_proxy%2Fmod.ts" alt="oak-http-proxy dependency outdatedness" /></a> | ||
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/oak_http_proxy/mod.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fcache-size%2Fx%2Foak_http_proxy%2Fmod.ts" alt="oak-http-proxy cached size" /></a> | ||
</p> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/oak_http_proxy@2.1.0/mod.ts"</span>; | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/oak_http_proxy@2.2.0/mod.ts"</span>; | ||
<span class="hljs-keyword">import</span> { Application } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/[email protected]/mod.ts"</span>; | ||
|
||
<span class="hljs-keyword">const</span> app = <span class="hljs-keyword">new</span> Application(); | ||
|
@@ -89,10 +89,10 @@ <h2>Installation</h2> | |
<p>This is a <a href="https://deno.land/">Deno</a> module available to import direct from this repo and via the <a href="https://deno.land/x">Deno Registry</a>.</p> | ||
<p>Before importing, <a href="https://deno.land/#installation">download and install Deno</a>.</p> | ||
<p>You can then import oak-http-proxy straight into your project:</p> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/oak_http_proxy@2.1.0/mod.ts"</span>; | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/oak_http_proxy@2.2.0/mod.ts"</span>; | ||
</code></pre> | ||
<p>oak-http-proxy is also available on <a href="https://nest.land/package/oak-http-proxy">nest.land</a>, a package registry for Deno on the Blockchain.</p> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://x.nest.land/oak-http-proxy@2.1.0/mod.ts"</span>; | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://x.nest.land/oak-http-proxy@2.2.0/mod.ts"</span>; | ||
</code></pre> | ||
<a href="#docs" id="docs" style="color: inherit; text-decoration: none;"> | ||
<h2>Docs</h2> | ||
|
@@ -114,7 +114,10 @@ <h3>URL</h3> | |
|
||
router.get(<span class="hljs-string">"/url"</span>, proxy(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">"http://google.com"</span>))); | ||
|
||
router.get(<span class="hljs-string">"/function"</span>, proxy(<span class="hljs-function">(<span class="hljs-params">ctx</span>) =></span> <span class="hljs-keyword">new</span> URL(<span class="hljs-string">"http://google.com"</span>))); | ||
router.get( | ||
<span class="hljs-string">"/function"</span>, | ||
proxy(<span class="hljs-function">(<span class="hljs-params">ctx</span>) =></span> <span class="hljs-keyword">new</span> URL(<span class="hljs-string">"http://google.com"</span>)) | ||
); | ||
</code></pre> | ||
<p>Note: Unmatched path segments of the incoming request url <em>are not</em> transferred to the outbound proxy URL. For dynamic proxy urls use the function form.</p> | ||
<a href="#proxy-options" id="proxy-options" style="color: inherit; text-decoration: none;"> | ||
|
@@ -268,7 +271,7 @@ <h3>proxyErrorHandler</h3> | |
<span class="hljs-keyword">return</span>; | ||
} | ||
<span class="hljs-attr">default</span>: { | ||
ctx.throw(err) | ||
ctx.throw(err); | ||
} | ||
} | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.