@jaredwray/mockhttp 2.1.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -67
- package/dist/index.d.mts +175 -159
- package/dist/index.mjs +513 -232
- package/package.json +24 -19
- package/site/dist/api/index.html +191 -5
- package/site/dist/api/swagger.json +235 -10
- package/site/dist/changelog/index.html +35 -33
- package/site/dist/changelog/page/2/index.html +33 -30
- package/site/dist/changelog/{v0-2-1 → v3-0-0}/index.html +73 -9
- package/site/dist/changelog/{v0-2-0 → v3-0-1}/index.html +83 -8
- package/site/dist/changelog-latest.json +26 -26
- package/site/dist/changelog.json +26 -26
- package/site/dist/docs/bins/index.html +97 -50
- package/site/dist/docs/configuration/index.html +2 -2
- package/site/dist/docs/hosted/index.html +3 -3
- package/site/dist/docs/how-to-deploy/cloudflare/index.html +8 -8
- package/site/dist/docs/how-to-deploy/docker/index.html +2 -2
- package/site/dist/docs/how-to-deploy/wasmer/index.html +4 -4
- package/site/dist/docs/https/index.html +2 -2
- package/site/dist/docs/index.html +2 -2
- package/site/dist/docs/library/index.html +19 -23
- package/site/dist/docs/taps/index.html +2 -2
- package/site/dist/feed.xml +1 -1
- package/site/dist/index.html +2 -2
- package/site/dist/llms-full.txt +511 -105
- package/site/dist/llms.txt +2 -2
- package/site/dist/search-index.json +1 -1
- package/site/dist/sitemap.xml +1 -1
package/site/dist/changelog.json
CHANGED
|
@@ -5,6 +5,32 @@
|
|
|
5
5
|
"home_page_url": "https://mockhttp.org/",
|
|
6
6
|
"feed_url": "https://mockhttp.org/changelog.json",
|
|
7
7
|
"items": [
|
|
8
|
+
{
|
|
9
|
+
"id": "v3-0-1",
|
|
10
|
+
"title": "v3.0.1",
|
|
11
|
+
"url": "https://mockhttp.org/changelog/v3-0-1/",
|
|
12
|
+
"date_published": "2026-10-28",
|
|
13
|
+
"date_modified": "2026-10-28",
|
|
14
|
+
"summary": "<p>Security patches and Worker fixes. /healthz omits scheme, host, username, and password length.</p>\n<ul>\n<li>start the Worker during isolate startup (#248)</li>\n<li>report bin store health and keep a failed connect in process (#249)</li>\n<li>drop every second socket error that has no listener (#250)</li>\n<li>Add redacted URI diagnostics to /healthz (#254)</li>\n<li>open one MongoDB client per Worker request to stop 1101s on bins (#255)</li>\n<li>pin Node 24.22.1 and patched undici (#256)</li>\n</ul>",
|
|
15
|
+
"content_html": "<h2 id=\"jaredwraymockhttp301--2026-10-28\">@jaredwray/mockhttp@3.0.1 — 2026-10-28</h2>\n<p>Security patches and Worker fixes. /healthz omits scheme, host, username, and password length.</p>\n<h3 id=\"bug-fixes\">Bug Fixes</h3>\n<ul>\n<li>\n<p>start the Worker during isolate startup (#248)</p>\n</li>\n<li>\n<p>report bin store health and keep a failed connect in process (#249)</p>\n</li>\n<li>\n<p>drop every second socket error that has no listener (#250)</p>\n</li>\n<li>\n<p>Add redacted URI diagnostics to /healthz (#254)</p>\n</li>\n<li>\n<p>open one MongoDB client per Worker request to stop 1101s on bins (#255)</p>\n</li>\n<li>\n<p>pin Node 24.22.1 and patched undici (#256)</p>\n</li>\n<li>\n<p>force miniflare's sharp pin to 0.35.5 (#257)</p>\n</li>\n<li>\n<p>bump zod to 4.6.7 for GHSA-mrhx-c7xc-m3w5 (#258)</p>\n</li>\n<li>\n<p>security - markdown-it 15.0.3 (CVE-2026-111758) (#260)</p>\n</li>\n<li>\n<p>omit scheme and URI identity from /healthz (#262)</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\r\n <span class=\"hljs-attr\">\"status\"</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">\"ok\"</span><span class=\"hljs-punctuation\">,</span>\r\n <span class=\"hljs-attr\">\"bins\"</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">{</span>\r\n <span class=\"hljs-attr\">\"connected\"</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-literal\"><span class=\"hljs-keyword\">true</span></span><span class=\"hljs-punctuation\">,</span>\r\n <span class=\"hljs-attr\">\"uriPresent\"</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-literal\"><span class=\"hljs-keyword\">true</span></span><span class=\"hljs-punctuation\">,</span>\r\n <span class=\"hljs-attr\">\"uri\"</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">{</span>\r\n <span class=\"hljs-attr\">\"atCount\"</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-number\">1</span><span class=\"hljs-punctuation\">,</span>\r\n <span class=\"hljs-attr\">\"passwordHasPercent\"</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-literal\"><span class=\"hljs-keyword\">false</span></span>\r\n <span class=\"hljs-punctuation\">}</span>\r\n <span class=\"hljs-punctuation\">}</span>\r\n<span class=\"hljs-punctuation\">}</span>\n</code></pre>\n</li>\n</ul>\n<h3 id=\"documentation\">Documentation</h3>\n<ul>\n<li>remove the empty vars note from the Cloudflare page (#253)</li>\n</ul>\n<h3 id=\"internal\">Internal</h3>\n<ul>\n<li>point worker URI fixtures at example.invalid (#251)</li>\n<li>declare empty Worker vars in Wrangler (#252)</li>\n<li>list LICENSE in the published package files (#259)</li>\n</ul>\n<h3 id=\"contributors\">Contributors</h3>\n<ul>\n<li>@jaredwray (13)</li>\n<li>@cursoragent (1)</li>\n</ul>\n<h3 id=\"full-list-of-changes\">Full List of Changes</h3>\n<ul>\n<li>fix: restore Cloudflare Worker routes after the v3.0.0 startup crash by @jaredwray in #248</li>\n<li>Add GET /healthz and redact bin store errors by @jaredwray in #249</li>\n<li>Use example.invalid for worker test URI fixtures by @jaredwray in #251</li>\n<li>Drop every second socket error that has no listener by @jaredwray in #250</li>\n<li>Declare empty Worker vars in Wrangler by @jaredwray in #252</li>\n<li>Remove the empty vars note from the Cloudflare page by @jaredwray in #253</li>\n<li>Add redacted URI diagnostics to /healthz by @jaredwray in #254</li>\n<li>fix: open one MongoDB client per Worker request to stop 1101s on bins by @jaredwray in #255</li>\n<li>security: pin Node 24.22.1 and patched undici by @jaredwray in #256</li>\n<li>fix: security - upgrade sharp to 0.35.5 (libheif RCE) by @jaredwray in #257</li>\n<li>fix: security - bump zod to 4.6.7 (GHSA-mrhx-c7xc-m3w5) by @jaredwray in #258</li>\n<li>chore: list LICENSE in the published package files by @jaredwray in #259</li>\n<li>fix: security - markdown-it 15.0.3 (CVE-2026-111758) by @jaredwray in #260</li>\n<li>fix: omit scheme and URI identity from /healthz by @jaredwray in #262</li>\n</ul>\n<p><strong>Full diff:</strong> <a href=\"https://github.com/jaredwray/mockhttp/compare/v3.0.0...v3.0.1\">https://github.com/jaredwray/mockhttp/compare/v3.0.0...v3.0.1</a></p>",
|
|
16
|
+
"content_text": "## @jaredwray/mockhttp@3.0.1 — 2026-10-28\r\n\r\nSecurity patches and Worker fixes. /healthz omits scheme, host, username, and password length.\r\n\r\n### Bug Fixes\r\n- start the Worker during isolate startup (#248)\r\n- report bin store health and keep a failed connect in process (#249)\r\n- drop every second socket error that has no listener (#250)\r\n- Add redacted URI diagnostics to /healthz (#254)\r\n- open one MongoDB client per Worker request to stop 1101s on bins (#255)\r\n- pin Node 24.22.1 and patched undici (#256)\r\n- force miniflare's sharp pin to 0.35.5 (#257)\r\n- bump zod to 4.6.7 for GHSA-mrhx-c7xc-m3w5 (#258)\r\n- security - markdown-it 15.0.3 (CVE-2026-111758) (#260)\r\n- omit scheme and URI identity from /healthz (#262)\r\n\r\n ```json\r\n {\r\n \"status\": \"ok\",\r\n \"bins\": {\r\n \"connected\": true,\r\n \"uriPresent\": true,\r\n \"uri\": {\r\n \"atCount\": 1,\r\n \"passwordHasPercent\": false\r\n }\r\n }\r\n }\r\n ```\r\n\r\n### Documentation\r\n- remove the empty vars note from the Cloudflare page (#253)\r\n\r\n### Internal\r\n- point worker URI fixtures at example.invalid (#251)\r\n- declare empty Worker vars in Wrangler (#252)\r\n- list LICENSE in the published package files (#259)\r\n\r\n### Contributors\r\n- @jaredwray (13)\r\n- @cursoragent (1)\r\n\r\n### Full List of Changes\r\n- fix: restore Cloudflare Worker routes after the v3.0.0 startup crash by @jaredwray in #248\r\n- Add GET /healthz and redact bin store errors by @jaredwray in #249\r\n- Use example.invalid for worker test URI fixtures by @jaredwray in #251\r\n- Drop every second socket error that has no listener by @jaredwray in #250\r\n- Declare empty Worker vars in Wrangler by @jaredwray in #252\r\n- Remove the empty vars note from the Cloudflare page by @jaredwray in #253\r\n- Add redacted URI diagnostics to /healthz by @jaredwray in #254\r\n- fix: open one MongoDB client per Worker request to stop 1101s on bins by @jaredwray in #255\r\n- security: pin Node 24.22.1 and patched undici by @jaredwray in #256\r\n- fix: security - upgrade sharp to 0.35.5 (libheif RCE) by @jaredwray in #257\r\n- fix: security - bump zod to 4.6.7 (GHSA-mrhx-c7xc-m3w5) by @jaredwray in #258\r\n- chore: list LICENSE in the published package files by @jaredwray in #259\r\n- fix: security - markdown-it 15.0.3 (CVE-2026-111758) by @jaredwray in #260\r\n- fix: omit scheme and URI identity from /healthz by @jaredwray in #262\r\n\r\n**Full diff:** [https://github.com/jaredwray/mockhttp/compare/v3.0.0...v3.0.1](https://github.com/jaredwray/mockhttp/compare/v3.0.0...v3.0.1)",
|
|
17
|
+
"tags": [
|
|
18
|
+
"Release"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "v3-0-0",
|
|
23
|
+
"title": "v3.0.0",
|
|
24
|
+
"url": "https://mockhttp.org/changelog/v3-0-0/",
|
|
25
|
+
"date_published": "2026-10-20",
|
|
26
|
+
"date_modified": "2026-10-20",
|
|
27
|
+
"summary": "<p>Request bins now use Keyv via MockHttpBins, and the Worker can store them in MongoDB Atlas.</p>\n<ul>\n<li>Replace <code>BinManager</code>, <code>BinStore</code>, and <code>InMemoryBinStore</code> with async <code>MockHttpBins</code>. <code>mock.bins.start()</code> and <code>mock.bins.stop()</code> are removed. The default <code>maxBodySize</code> is 128 KiB (was 1 MiB). Node engines are now <code>>=22.19.0</code> (was <code>>=22.18.0</code>). (<code>b1ddcc0</code>, #246)\r\nMigration: assign <code>mock.bins = new MockHttpBins({ keyv })</code> before <code>start()</code> (default store is <code>new Keyv()</code>) and <code>await</code> the bin...</li>\n</ul>",
|
|
28
|
+
"content_html": "<h2 id=\"jaredwraymockhttp300--2026-10-19\">@jaredwray/mockhttp@3.0.0 — 2026-10-19</h2>\n<p>Request bins now use Keyv via MockHttpBins, and the Worker can store them in MongoDB Atlas.</p>\n<h3 id=\"-breaking-changes\">⚠ BREAKING CHANGES</h3>\n<ul>\n<li>\n<p>Replace <code>BinManager</code>, <code>BinStore</code>, and <code>InMemoryBinStore</code> with async <code>MockHttpBins</code>. <code>mock.bins.start()</code> and <code>mock.bins.stop()</code> are removed. The default <code>maxBodySize</code> is 128 KiB (was 1 MiB). Node engines are now <code>>=22.19.0</code> (was <code>>=22.18.0</code>). (<code>b1ddcc0</code>, #246)\r\nMigration: assign <code>mock.bins = new MockHttpBins({ keyv })</code> before <code>start()</code> (default store is <code>new Keyv()</code>) and <code>await</code> the bin methods.</p>\n<pre><code class=\"hljs language-ts\"><span class=\"hljs-keyword\">import</span> <span class=\"hljs-title class_\">Keyv</span> <span class=\"hljs-keyword\">from</span> <span class=\"hljs-string\">\"keyv\"</span>;\r\n<span class=\"hljs-keyword\">import</span> { <span class=\"hljs-title class_\">MockHttp</span>, <span class=\"hljs-title class_\">MockHttpBins</span> } <span class=\"hljs-keyword\">from</span> <span class=\"hljs-string\">\"@jaredwray/mockhttp\"</span>;\r\n\r\n<span class=\"hljs-keyword\">const</span> mock = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-title class_\">MockHttp</span>();\r\nmock.<span class=\"hljs-property\">bins</span> = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-title class_\">MockHttpBins</span>({ <span class=\"hljs-attr\">keyv</span>: <span class=\"hljs-keyword\">new</span> <span class=\"hljs-title class_\">Keyv</span>(), <span class=\"hljs-attr\">maxBodySize</span>: <span class=\"hljs-number\">128</span> * <span class=\"hljs-number\">1024</span> });\r\n<span class=\"hljs-keyword\">await</span> mock.<span class=\"hljs-title function_\">start</span>();\r\n<span class=\"hljs-keyword\">const</span> bin = <span class=\"hljs-keyword\">await</span> mock.<span class=\"hljs-property\">bins</span>.<span class=\"hljs-title function_\">createBin</span>();\n</code></pre>\n</li>\n</ul>\n<h3 id=\"features\">Features</h3>\n<ul>\n<li>\n<p>Store Worker request bins in MongoDB Atlas when <code>MONGODB_URI</code> is set (<code>266157b</code>, #247)</p>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Cloudflare Worker secret. Bins go in the Atlas `bins` collection.</span>\r\n<span class=\"hljs-comment\"># Leave MONGODB_URI unset to keep the in-memory Keyv.</span>\r\nwrangler secret put MONGODB_URI\n</code></pre>\n</li>\n</ul>\n<h3 id=\"bug-fixes\">Bug Fixes</h3>\n<ul>\n<li>security - upgrade fastify proxy-addr, fast-uri, find-my-way, undici (<code>9c52869</code>, #233)</li>\n<li>security - upgrade handlebars, source-map-js (<code>28aa662</code>, #236)</li>\n</ul>\n<h3 id=\"internal\">Internal</h3>\n<ul>\n<li>sync defense-in-depth files from agentic (<code>7fb3ce4</code>, #234)</li>\n<li>upgrade code quality dependencies (<code>a57b990</code>, #235)</li>\n<li>upgrade TypeScript and build tooling (<code>b11fa0f</code>, #237)</li>\n<li>upgrade monorepo tooling (<code>58e8596</code>, #238)</li>\n<li>upgrade GitHub Actions (<code>58bc448</code>, #239)</li>\n<li>upgrade Dev Container images (<code>2047c3c</code>, #240)</li>\n<li>upgrade Fastify dependencies (<code>3e93bea</code>, #241)</li>\n<li>upgrade hookified (<code>d938e6e</code>, #242)</li>\n<li>upgrade pino and pino-pretty (<code>c2a94ad</code>, #243)</li>\n<li>upgrade Docker Node.js runtime image (<code>cd5decf</code>, #244)</li>\n<li>pin the Compose image (<code>74ad4ea</code>, #245)</li>\n</ul>\n<h3 id=\"contributors\">Contributors</h3>\n<ul>\n<li>@jaredwray (11)</li>\n<li>@cursoragent (5)</li>\n</ul>\n<h3 id=\"full-list-of-changes\">Full List of Changes</h3>\n<ul>\n<li>fix: security - upgrade fastify proxy-addr, fast-uri, find-my-way, undici by @jaredwray in #233</li>\n<li>mono - chore: sync defense-in-depth files from agentic by @jaredwray in #234</li>\n<li>mono - chore: upgrade code quality dependencies by @jaredwray in #235</li>\n<li>fix: security - upgrade handlebars, source-map-js by @jaredwray in #236</li>\n<li>mono - chore: upgrade TypeScript and build tooling by @jaredwray in #237</li>\n<li>mono - chore: upgrade monorepo tooling by @jaredwray in #238</li>\n<li>mono - chore: upgrade GitHub Actions by @jaredwray in #239</li>\n<li>mono - chore: upgrade Dev Container images by @jaredwray in #240</li>\n<li>mono - chore: upgrade Fastify dependencies by @jaredwray in #241</li>\n<li>mono - chore: upgrade hookified by @jaredwray in #242</li>\n<li>mono - chore: upgrade pino and pino-pretty by @jaredwray in #243</li>\n<li>mono - chore: upgrade Docker Node.js runtime image by @jaredwray in #244</li>\n<li>mono - chore: pin the Compose image by @jaredwray in #245</li>\n<li>Store request bins in Keyv by @jaredwray in #246</li>\n<li>Store Worker request bins in MongoDB Atlas by @jaredwray in #247</li>\n</ul>\n<p><strong>Full diff:</strong> <a href=\"https://github.com/jaredwray/mockhttp/compare/v2.1.0...v3.0.0\">https://github.com/jaredwray/mockhttp/compare/v2.1.0...v3.0.0</a></p>",
|
|
29
|
+
"content_text": "## @jaredwray/mockhttp@3.0.0 — 2026-10-19\r\n\r\nRequest bins now use Keyv via MockHttpBins, and the Worker can store them in MongoDB Atlas.\r\n\r\n### ⚠ BREAKING CHANGES\r\n- Replace `BinManager`, `BinStore`, and `InMemoryBinStore` with async `MockHttpBins`. `mock.bins.start()` and `mock.bins.stop()` are removed. The default `maxBodySize` is 128 KiB (was 1 MiB). Node engines are now `>=22.19.0` (was `>=22.18.0`). (`b1ddcc0`, #246)\r\n Migration: assign `mock.bins = new MockHttpBins({ keyv })` before `start()` (default store is `new Keyv()`) and `await` the bin methods.\r\n\r\n ```ts\r\n import Keyv from \"keyv\";\r\n import { MockHttp, MockHttpBins } from \"@jaredwray/mockhttp\";\r\n\r\n const mock = new MockHttp();\r\n mock.bins = new MockHttpBins({ keyv: new Keyv(), maxBodySize: 128 * 1024 });\r\n await mock.start();\r\n const bin = await mock.bins.createBin();\r\n ```\r\n\r\n### Features\r\n- Store Worker request bins in MongoDB Atlas when `MONGODB_URI` is set (`266157b`, #247)\r\n\r\n ```bash\r\n # Cloudflare Worker secret. Bins go in the Atlas `bins` collection.\r\n # Leave MONGODB_URI unset to keep the in-memory Keyv.\r\n wrangler secret put MONGODB_URI\r\n ```\r\n\r\n### Bug Fixes\r\n- security - upgrade fastify proxy-addr, fast-uri, find-my-way, undici (`9c52869`, #233)\r\n- security - upgrade handlebars, source-map-js (`28aa662`, #236)\r\n\r\n### Internal\r\n- sync defense-in-depth files from agentic (`7fb3ce4`, #234)\r\n- upgrade code quality dependencies (`a57b990`, #235)\r\n- upgrade TypeScript and build tooling (`b11fa0f`, #237)\r\n- upgrade monorepo tooling (`58e8596`, #238)\r\n- upgrade GitHub Actions (`58bc448`, #239)\r\n- upgrade Dev Container images (`2047c3c`, #240)\r\n- upgrade Fastify dependencies (`3e93bea`, #241)\r\n- upgrade hookified (`d938e6e`, #242)\r\n- upgrade pino and pino-pretty (`c2a94ad`, #243)\r\n- upgrade Docker Node.js runtime image (`cd5decf`, #244)\r\n- pin the Compose image (`74ad4ea`, #245)\r\n\r\n### Contributors\r\n- @jaredwray (11)\r\n- @cursoragent (5)\r\n\r\n### Full List of Changes\r\n- fix: security - upgrade fastify proxy-addr, fast-uri, find-my-way, undici by @jaredwray in #233\r\n- mono - chore: sync defense-in-depth files from agentic by @jaredwray in #234\r\n- mono - chore: upgrade code quality dependencies by @jaredwray in #235\r\n- fix: security - upgrade handlebars, source-map-js by @jaredwray in #236\r\n- mono - chore: upgrade TypeScript and build tooling by @jaredwray in #237\r\n- mono - chore: upgrade monorepo tooling by @jaredwray in #238\r\n- mono - chore: upgrade GitHub Actions by @jaredwray in #239\r\n- mono - chore: upgrade Dev Container images by @jaredwray in #240\r\n- mono - chore: upgrade Fastify dependencies by @jaredwray in #241\r\n- mono - chore: upgrade hookified by @jaredwray in #242\r\n- mono - chore: upgrade pino and pino-pretty by @jaredwray in #243\r\n- mono - chore: upgrade Docker Node.js runtime image by @jaredwray in #244\r\n- mono - chore: pin the Compose image by @jaredwray in #245\r\n- Store request bins in Keyv by @jaredwray in #246\r\n- Store Worker request bins in MongoDB Atlas by @jaredwray in #247\r\n\r\n**Full diff:** [https://github.com/jaredwray/mockhttp/compare/v2.1.0...v3.0.0](https://github.com/jaredwray/mockhttp/compare/v2.1.0...v3.0.0)",
|
|
30
|
+
"tags": [
|
|
31
|
+
"Release"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
8
34
|
{
|
|
9
35
|
"id": "v2-1-0",
|
|
10
36
|
"title": "v2.1.0",
|
|
@@ -368,32 +394,6 @@
|
|
|
368
394
|
"tags": [
|
|
369
395
|
"Release"
|
|
370
396
|
]
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"id": "v0-2-1",
|
|
374
|
-
"title": "v0.2.1",
|
|
375
|
-
"url": "https://mockhttp.org/changelog/v0-2-1/",
|
|
376
|
-
"date_published": "2024-12-13",
|
|
377
|
-
"date_modified": "2024-12-13",
|
|
378
|
-
"summary": "<ul>\n<li>moving to logging on a single line by @jaredwray in <a href=\"https://github.com/jaredwray/mockhttp/pull/15\">https://github.com/jaredwray/mockhttp/pull/15</a></li>\n<li>upgrading scalar to 1.25.82 by @jaredwray in <a href=\"https://github.com/jaredwray/mockhttp/pull/16\">https://github.com/jaredwray/mockhttp/pull/16</a></li>\n</ul>\n<p><strong>Full Changelog</strong>: <a href=\"https://github.com/jaredwray/mockhttp/compare/v0.2.0...v0.2.1\">https://github.com/jaredwray/mockhttp/compare/v0.2.0...v0.2.1</a></p>",
|
|
379
|
-
"content_html": "<h2 id=\"whats-changed\">What's Changed</h2>\n<ul>\n<li>moving to logging on a single line by @jaredwray in <a href=\"https://github.com/jaredwray/mockhttp/pull/15\">https://github.com/jaredwray/mockhttp/pull/15</a></li>\n<li>upgrading scalar to 1.25.82 by @jaredwray in <a href=\"https://github.com/jaredwray/mockhttp/pull/16\">https://github.com/jaredwray/mockhttp/pull/16</a></li>\n</ul>\n<p><strong>Full Changelog</strong>: <a href=\"https://github.com/jaredwray/mockhttp/compare/v0.2.0...v0.2.1\">https://github.com/jaredwray/mockhttp/compare/v0.2.0...v0.2.1</a></p>",
|
|
380
|
-
"content_text": "## What's Changed\r\n* moving to logging on a single line by @jaredwray in [https://github.com/jaredwray/mockhttp/pull/15](https://github.com/jaredwray/mockhttp/pull/15)\r\n* upgrading scalar to 1.25.82 by @jaredwray in [https://github.com/jaredwray/mockhttp/pull/16](https://github.com/jaredwray/mockhttp/pull/16)\r\n\r\n\r\n**Full Changelog**: [https://github.com/jaredwray/mockhttp/compare/v0.2.0...v0.2.1](https://github.com/jaredwray/mockhttp/compare/v0.2.0...v0.2.1)",
|
|
381
|
-
"tags": [
|
|
382
|
-
"Release"
|
|
383
|
-
]
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
"id": "v0-2-0",
|
|
387
|
-
"title": "v0.2.0",
|
|
388
|
-
"url": "https://mockhttp.org/changelog/v0-2-0/",
|
|
389
|
-
"date_published": "2024-12-13",
|
|
390
|
-
"date_modified": "2024-12-13",
|
|
391
|
-
"summary": "<ul>\n<li>response inspection by @jaredwray in <a href=\"https://github.com/jaredwray/mockhttp/pull/14\">https://github.com/jaredwray/mockhttp/pull/14</a></li>\n</ul>\n<p><strong>Full Changelog</strong>: <a href=\"https://github.com/jaredwray/mockhttp/compare/v0.1.0...v0.2.0\">https://github.com/jaredwray/mockhttp/compare/v0.1.0...v0.2.0</a></p>",
|
|
392
|
-
"content_html": "<h2 id=\"whats-changed\">What's Changed</h2>\n<ul>\n<li>response inspection by @jaredwray in <a href=\"https://github.com/jaredwray/mockhttp/pull/14\">https://github.com/jaredwray/mockhttp/pull/14</a></li>\n</ul>\n<p><strong>Full Changelog</strong>: <a href=\"https://github.com/jaredwray/mockhttp/compare/v0.1.0...v0.2.0\">https://github.com/jaredwray/mockhttp/compare/v0.1.0...v0.2.0</a></p>",
|
|
393
|
-
"content_text": "## What's Changed\r\n* response inspection by @jaredwray in [https://github.com/jaredwray/mockhttp/pull/14](https://github.com/jaredwray/mockhttp/pull/14)\r\n\r\n\r\n**Full Changelog**: [https://github.com/jaredwray/mockhttp/compare/v0.1.0...v0.2.0](https://github.com/jaredwray/mockhttp/compare/v0.1.0...v0.2.0)",
|
|
394
|
-
"tags": [
|
|
395
|
-
"Release"
|
|
396
|
-
]
|
|
397
397
|
}
|
|
398
398
|
]
|
|
399
399
|
}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</script>
|
|
36
36
|
<title>MockHTTP - Bins</title>
|
|
37
37
|
<script type="application/ld+json">
|
|
38
|
-
{"@context":"https://schema.org","@type":"TechArticle","headline":"Bins","description":"","url":"https://mockhttp.org/docs/bins/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-
|
|
38
|
+
{"@context":"https://schema.org","@type":"TechArticle","headline":"Bins","description":"","url":"https://mockhttp.org/docs/bins/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-28","keywords":[]}
|
|
39
39
|
</script>
|
|
40
40
|
</head>
|
|
41
41
|
|
|
@@ -312,6 +312,7 @@ here is stored against bin <code>:id</code></li>
|
|
|
312
312
|
<ul>
|
|
313
313
|
<li><a href="#quick-start">Quick Start</a></li>
|
|
314
314
|
<li><a href="#endpoints">Endpoints</a></li>
|
|
315
|
+
<li><a href="#storage-health">Storage health</a></li>
|
|
315
316
|
<li><a href="#end-to-end-webhook-debugging-example">End-to-End Webhook Debugging Example</a></li>
|
|
316
317
|
<li><a href="#captured-request-shape">Captured Request Shape</a></li>
|
|
317
318
|
<li><a href="#body-encoding-examples">Body Encoding Examples</a>
|
|
@@ -330,7 +331,7 @@ here is stored against bin <code>:id</code></li>
|
|
|
330
331
|
<li><a href="#configuration">Configuration</a>
|
|
331
332
|
<ul>
|
|
332
333
|
<li><a href="#defaults">Defaults</a></li>
|
|
333
|
-
<li><a href="#
|
|
334
|
+
<li><a href="#storage">Storage</a></li>
|
|
334
335
|
</ul>
|
|
335
336
|
</li>
|
|
336
337
|
</ul>
|
|
@@ -401,8 +402,67 @@ curl http://localhost:3000/bins/abc123def456/requests
|
|
|
401
402
|
<td><code>/b/:id</code> and <code>/b/:id/*</code></td>
|
|
402
403
|
<td>Capture requests sent to a bin</td>
|
|
403
404
|
</tr>
|
|
405
|
+
<tr>
|
|
406
|
+
<td>GET</td>
|
|
407
|
+
<td><code>/healthz</code></td>
|
|
408
|
+
<td>Check whether bin storage is reachable</td>
|
|
409
|
+
</tr>
|
|
404
410
|
</tbody>
|
|
405
411
|
</table>
|
|
412
|
+
<h2 id="storage-health">Storage health</h2>
|
|
413
|
+
<p><code>GET /healthz</code> is on the Node server and the Worker. This route does not create a bin.</p>
|
|
414
|
+
<p>A memory store sends HTTP 200:</p>
|
|
415
|
+
<pre><code class="hljs language-json"><span class="hljs-punctuation">{</span>
|
|
416
|
+
<span class="hljs-attr">"status"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"ok"</span><span class="hljs-punctuation">,</span>
|
|
417
|
+
<span class="hljs-attr">"bins"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
|
|
418
|
+
<span class="hljs-attr">"store"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"memory"</span><span class="hljs-punctuation">,</span>
|
|
419
|
+
<span class="hljs-attr">"connected"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">true</span></span><span class="hljs-punctuation">,</span>
|
|
420
|
+
<span class="hljs-attr">"latencyMs"</span><span class="hljs-punctuation">:</span> <span class="hljs-number">1</span><span class="hljs-punctuation">,</span>
|
|
421
|
+
<span class="hljs-attr">"uriPresent"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span>
|
|
422
|
+
<span class="hljs-punctuation">}</span>
|
|
423
|
+
<span class="hljs-punctuation">}</span>
|
|
424
|
+
</code></pre>
|
|
425
|
+
<p>The Worker uses MongoDB when <code>MONGODB_URI</code> is set. The check opens a client, sends an admin ping, and then closes the client. The timeout is short. The check does not keep the client after a failure.</p>
|
|
426
|
+
<p>A successful ping sends HTTP 200. <code>store</code> is <code>mongo</code>.</p>
|
|
427
|
+
<p>A failed ping sends HTTP 503:</p>
|
|
428
|
+
<pre><code class="hljs language-json"><span class="hljs-punctuation">{</span>
|
|
429
|
+
<span class="hljs-attr">"status"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"error"</span><span class="hljs-punctuation">,</span>
|
|
430
|
+
<span class="hljs-attr">"bins"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
|
|
431
|
+
<span class="hljs-attr">"store"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"mongo"</span><span class="hljs-punctuation">,</span>
|
|
432
|
+
<span class="hljs-attr">"connected"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>
|
|
433
|
+
<span class="hljs-attr">"uriPresent"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">true</span></span><span class="hljs-punctuation">,</span>
|
|
434
|
+
<span class="hljs-attr">"uri"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
|
|
435
|
+
<span class="hljs-attr">"length"</span><span class="hljs-punctuation">:</span> <span class="hljs-number">78</span><span class="hljs-punctuation">,</span>
|
|
436
|
+
<span class="hljs-attr">"leadingWhitespace"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>
|
|
437
|
+
<span class="hljs-attr">"trailingWhitespace"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>
|
|
438
|
+
<span class="hljs-attr">"newline"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>
|
|
439
|
+
<span class="hljs-attr">"wrappedQuotes"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>
|
|
440
|
+
<span class="hljs-attr">"atCount"</span><span class="hljs-punctuation">:</span> <span class="hljs-number">2</span><span class="hljs-punctuation">,</span>
|
|
441
|
+
<span class="hljs-attr">"passwordReserved"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">"@"</span><span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
|
|
442
|
+
<span class="hljs-attr">"passwordHasPercent"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span>
|
|
443
|
+
<span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
|
|
444
|
+
<span class="hljs-attr">"error"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
|
|
445
|
+
<span class="hljs-attr">"name"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"MongoParseError"</span><span class="hljs-punctuation">,</span>
|
|
446
|
+
<span class="hljs-attr">"message"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Invalid connection string. Percent-encode reserved characters in the username and password (@ : / ? # [ ] $)."</span><span class="hljs-punctuation">,</span>
|
|
447
|
+
<span class="hljs-attr">"code"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">null</span></span>
|
|
448
|
+
<span class="hljs-punctuation">}</span>
|
|
449
|
+
<span class="hljs-punctuation">}</span>
|
|
450
|
+
<span class="hljs-punctuation">}</span>
|
|
451
|
+
</code></pre>
|
|
452
|
+
<p>A MongoDB result includes <code>bins.uri</code> on success and on failure. A memory result omits <code>bins.uri</code>. The response does not include the scheme, the host, the username, or the password length.</p>
|
|
453
|
+
<p><code>uri.passwordReserved</code> lists raw reserved characters in the password. The list is empty when the password has only reserved characters. <code>uri.passwordHasPercent</code> is true when the password contains <code>%</code>. The response does not contain the connection string or the password. The logs do not contain the connection string, the username, the password, or the host. <code>uriPresent</code> is a boolean.</p>
|
|
454
|
+
<p><code>Invalid connection string</code> is the driver text. MockHTTP adds the percent-encode hint only for that text or for <code>unescaped characters</code>. A DNS error stays a DNS error. <code>Invalid connection string</code> means that the URI has a second <code>@</code>. It also means that you did not encode a reserved character in the username or the password. Encode these characters:</p>
|
|
455
|
+
<ul>
|
|
456
|
+
<li><code>@</code> as <code>%40</code></li>
|
|
457
|
+
<li><code>:</code> as <code>%3A</code></li>
|
|
458
|
+
<li><code>/</code> as <code>%2F</code></li>
|
|
459
|
+
<li><code>?</code> as <code>%3F</code></li>
|
|
460
|
+
<li><code>#</code> as <code>%23</code></li>
|
|
461
|
+
<li><code>[</code> as <code>%5B</code></li>
|
|
462
|
+
<li><code>]</code> as <code>%5D</code></li>
|
|
463
|
+
<li><code>$</code> as <code>%24</code></li>
|
|
464
|
+
</ul>
|
|
465
|
+
<p>A correct <code>mongodb+srv://</code> URI does not fail at parse time. A DNS failure or a network failure has a different error name.</p>
|
|
406
466
|
<h2 id="end-to-end-webhook-debugging-example">End-to-End Webhook Debugging Example</h2>
|
|
407
467
|
<p>A complete walkthrough using curl:</p>
|
|
408
468
|
<pre><code class="hljs language-bash">BASE=http://localhost:3000
|
|
@@ -514,11 +574,11 @@ curl -s <span class="hljs-string">"http://localhost:3000/bins/<span class="hljs-
|
|
|
514
574
|
| jq -r <span class="hljs-string">'.requests[0].body'</span> | <span class="hljs-built_in">base64</span> -d > recovered.png
|
|
515
575
|
</code></pre>
|
|
516
576
|
<h3 id="truncation">Truncation</h3>
|
|
517
|
-
<p>Bodies larger than <code>maxBodySize</code> (
|
|
577
|
+
<p>Bodies larger than <code>maxBodySize</code> (128 KiB by default) are cut off and flagged:</p>
|
|
518
578
|
<pre><code class="hljs language-javascript"><span class="hljs-comment">// In test setup</span>
|
|
519
|
-
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">MockHttp</span>, <span class="hljs-title class_">
|
|
579
|
+
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">MockHttp</span>, <span class="hljs-title class_">MockHttpBins</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'@jaredwray/mockhttp'</span>;
|
|
520
580
|
<span class="hljs-keyword">const</span> mock = <span class="hljs-keyword">new</span> <span class="hljs-title class_">MockHttp</span>();
|
|
521
|
-
mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">
|
|
581
|
+
mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">MockHttpBins</span>({ <span class="hljs-attr">maxBodySize</span>: <span class="hljs-number">1024</span> }); <span class="hljs-comment">// 1 KiB cap</span>
|
|
522
582
|
<span class="hljs-keyword">await</span> mock.<span class="hljs-title function_">start</span>();
|
|
523
583
|
</code></pre>
|
|
524
584
|
<pre><code class="hljs language-bash"><span class="hljs-comment"># Send 5000 bytes to a bin with a 1 KiB cap</span>
|
|
@@ -550,21 +610,20 @@ curl -s <span class="hljs-string">"http://localhost:3000/bins/<span class="hljs-
|
|
|
550
610
|
<span class="hljs-comment"># "/event/105"</span>
|
|
551
611
|
</code></pre>
|
|
552
612
|
<h2 id="programmatic-access">Programmatic Access</h2>
|
|
553
|
-
<p>
|
|
554
|
-
makes it easy to drive bins from a test suite without going through HTTP:</p>
|
|
613
|
+
<p>Use <code>mock.bins</code> to control request bins from a test. You do not need an HTTP call:</p>
|
|
555
614
|
<pre><code class="hljs language-javascript"><span class="hljs-keyword">import</span> { <span class="hljs-title class_">MockHttp</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'@jaredwray/mockhttp'</span>;
|
|
556
615
|
|
|
557
616
|
<span class="hljs-keyword">const</span> mock = <span class="hljs-keyword">new</span> <span class="hljs-title class_">MockHttp</span>({ <span class="hljs-attr">logging</span>: <span class="hljs-literal">false</span> });
|
|
558
617
|
<span class="hljs-keyword">await</span> mock.<span class="hljs-title function_">start</span>();
|
|
559
618
|
|
|
560
619
|
<span class="hljs-comment">// Create a bin</span>
|
|
561
|
-
<span class="hljs-keyword">const</span> bin = mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">createBin</span>();
|
|
620
|
+
<span class="hljs-keyword">const</span> bin = <span class="hljs-keyword">await</span> mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">createBin</span>();
|
|
562
621
|
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Webhook target: http://localhost:<span class="hljs-subst">${mock.port}</span>/b/<span class="hljs-subst">${bin.id}</span>`</span>);
|
|
563
622
|
|
|
564
623
|
<span class="hljs-comment">// ... point your code-under-test at that URL ...</span>
|
|
565
624
|
|
|
566
625
|
<span class="hljs-comment">// Read captured requests (newest first)</span>
|
|
567
|
-
<span class="hljs-keyword">const</span> requests = mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">getRequests</span>(bin.<span class="hljs-property">id</span>);
|
|
626
|
+
<span class="hljs-keyword">const</span> requests = <span class="hljs-keyword">await</span> mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">getRequests</span>(bin.<span class="hljs-property">id</span>);
|
|
568
627
|
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Captured <span class="hljs-subst">${requests.length}</span> requests`</span>);
|
|
569
628
|
|
|
570
629
|
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> req <span class="hljs-keyword">of</span> requests) {
|
|
@@ -572,8 +631,8 @@ makes it easy to drive bins from a test suite without going through HTTP:</p>
|
|
|
572
631
|
}
|
|
573
632
|
|
|
574
633
|
<span class="hljs-comment">// Clean up</span>
|
|
575
|
-
mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">deleteBin</span>(bin.<span class="hljs-property">id</span>);
|
|
576
|
-
<span class="hljs-keyword">await</span> mock.<span class="hljs-title function_">close</span>();
|
|
634
|
+
<span class="hljs-keyword">await</span> mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">deleteBin</span>(bin.<span class="hljs-property">id</span>);
|
|
635
|
+
<span class="hljs-keyword">await</span> mock.<span class="hljs-title function_">close</span>();
|
|
577
636
|
</code></pre>
|
|
578
637
|
<h3 id="using-bins-in-a-vitest-test">Using Bins in a Vitest Test</h3>
|
|
579
638
|
<pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> { afterAll, beforeAll, expect, test } <span class="hljs-keyword">from</span> <span class="hljs-string">'vitest'</span>;
|
|
@@ -591,14 +650,14 @@ mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">
|
|
|
591
650
|
});
|
|
592
651
|
|
|
593
652
|
<span class="hljs-title function_">test</span>(<span class="hljs-string">'my SDK sends the right webhook payload'</span>, <span class="hljs-title function_">async</span> () => {
|
|
594
|
-
<span class="hljs-keyword">const</span> bin = mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">createBin</span>();
|
|
653
|
+
<span class="hljs-keyword">const</span> bin = <span class="hljs-keyword">await</span> mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">createBin</span>();
|
|
595
654
|
<span class="hljs-keyword">const</span> webhookUrl = <span class="hljs-string">`http://localhost:<span class="hljs-subst">${mock.port}</span>/b/<span class="hljs-subst">${bin.id}</span>`</span>;
|
|
596
655
|
|
|
597
656
|
<span class="hljs-comment">// Drive your SDK at the bin</span>
|
|
598
657
|
<span class="hljs-keyword">await</span> mySdk.<span class="hljs-title function_">notify</span>(webhookUrl, { <span class="hljs-attr">event</span>: <span class="hljs-string">'user.created'</span>, <span class="hljs-attr">id</span>: <span class="hljs-number">42</span> });
|
|
599
658
|
|
|
600
659
|
<span class="hljs-comment">// Assert on what actually arrived</span>
|
|
601
|
-
<span class="hljs-keyword">const</span> [captured] = mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">getRequests</span>(bin.<span class="hljs-property">id</span>);
|
|
660
|
+
<span class="hljs-keyword">const</span> [captured] = <span class="hljs-keyword">await</span> mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">getRequests</span>(bin.<span class="hljs-property">id</span>);
|
|
602
661
|
<span class="hljs-title function_">expect</span>(captured.<span class="hljs-property">method</span>).<span class="hljs-title function_">toBe</span>(<span class="hljs-string">'POST'</span>);
|
|
603
662
|
<span class="hljs-title function_">expect</span>(captured.<span class="hljs-property">contentType</span>).<span class="hljs-title function_">toBe</span>(<span class="hljs-string">'application/json'</span>);
|
|
604
663
|
<span class="hljs-title function_">expect</span>(<span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">parse</span>(captured.<span class="hljs-property">body</span>!)).<span class="hljs-title function_">toEqual</span>({
|
|
@@ -614,16 +673,15 @@ mock.<span class="hljs-property">bins</span>.<span class="hljs-title function_">
|
|
|
614
673
|
<span class="hljs-attr">httpBin</span>: { <span class="hljs-attr">bins</span>: <span class="hljs-literal">false</span> },
|
|
615
674
|
});
|
|
616
675
|
</code></pre>
|
|
617
|
-
<p>To
|
|
618
|
-
<pre><code class="hljs language-javascript"><span class="hljs-keyword">import</span> { <span class="hljs-title class_">MockHttp</span>, <span class="hljs-title class_">
|
|
676
|
+
<p>To change the limits, replace the default <code>MockHttpBins</code> before you start the server:</p>
|
|
677
|
+
<pre><code class="hljs language-javascript"><span class="hljs-keyword">import</span> { <span class="hljs-title class_">MockHttp</span>, <span class="hljs-title class_">MockHttpBins</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'@jaredwray/mockhttp'</span>;
|
|
619
678
|
|
|
620
679
|
<span class="hljs-keyword">const</span> mock = <span class="hljs-keyword">new</span> <span class="hljs-title class_">MockHttp</span>();
|
|
621
|
-
mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">
|
|
680
|
+
mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">MockHttpBins</span>({
|
|
622
681
|
<span class="hljs-attr">defaultTtlMs</span>: <span class="hljs-number">60</span> * <span class="hljs-number">60</span> * <span class="hljs-number">1000</span>, <span class="hljs-comment">// 1 hour (default: 24h)</span>
|
|
623
682
|
<span class="hljs-attr">maxRequestsPerBin</span>: <span class="hljs-number">500</span>, <span class="hljs-comment">// (default: 100)</span>
|
|
624
|
-
<span class="hljs-attr">maxBodySize</span>: <span class="hljs-number">
|
|
683
|
+
<span class="hljs-attr">maxBodySize</span>: <span class="hljs-number">512</span> * <span class="hljs-number">1024</span>, <span class="hljs-comment">// 512 KiB (default: 128 KiB)</span>
|
|
625
684
|
<span class="hljs-attr">idLength</span>: <span class="hljs-number">16</span>, <span class="hljs-comment">// (default: 12)</span>
|
|
626
|
-
<span class="hljs-attr">cleanupIntervalMs</span>: <span class="hljs-number">30</span> * <span class="hljs-number">1000</span>, <span class="hljs-comment">// sweep every 30s (default: 60s)</span>
|
|
627
685
|
});
|
|
628
686
|
|
|
629
687
|
<span class="hljs-keyword">await</span> mock.<span class="hljs-title function_">start</span>();
|
|
@@ -641,7 +699,7 @@ mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</s
|
|
|
641
699
|
<tr>
|
|
642
700
|
<td><code>defaultTtlMs</code></td>
|
|
643
701
|
<td><code>86400000</code> (24h)</td>
|
|
644
|
-
<td>Bin lifetime
|
|
702
|
+
<td>Bin lifetime, set as the Keyv TTL. An expired bin returns 404.</td>
|
|
645
703
|
</tr>
|
|
646
704
|
<tr>
|
|
647
705
|
<td><code>maxRequestsPerBin</code></td>
|
|
@@ -650,7 +708,7 @@ mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</s
|
|
|
650
708
|
</tr>
|
|
651
709
|
<tr>
|
|
652
710
|
<td><code>maxBodySize</code></td>
|
|
653
|
-
<td><code>
|
|
711
|
+
<td><code>131072</code> (128 KiB)</td>
|
|
654
712
|
<td>Larger bodies are truncated; <code>truncated: true</code> is set on the capture.</td>
|
|
655
713
|
</tr>
|
|
656
714
|
<tr>
|
|
@@ -659,40 +717,29 @@ mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</s
|
|
|
659
717
|
<td>Length of generated bin and request ids.</td>
|
|
660
718
|
</tr>
|
|
661
719
|
<tr>
|
|
662
|
-
<td><code>
|
|
663
|
-
<td><code>
|
|
664
|
-
<td>
|
|
720
|
+
<td><code>keyv</code></td>
|
|
721
|
+
<td><code>new Keyv()</code></td>
|
|
722
|
+
<td>Keyv store for bins. The default keeps bins in memory.</td>
|
|
665
723
|
</tr>
|
|
666
724
|
</tbody>
|
|
667
725
|
</table>
|
|
668
|
-
<h3 id="
|
|
669
|
-
<p><code>
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
<
|
|
673
|
-
|
|
674
|
-
<span class="hljs-title class_">InMemoryBinStore</span>,
|
|
675
|
-
<span class="hljs-keyword">type</span> <span class="hljs-title class_">Bin</span>,
|
|
676
|
-
<span class="hljs-keyword">type</span> <span class="hljs-title class_">BinStore</span>,
|
|
677
|
-
<span class="hljs-keyword">type</span> <span class="hljs-title class_">CapturedRequest</span>,
|
|
678
|
-
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@jaredwray/mockhttp'</span>;
|
|
679
|
-
|
|
680
|
-
<span class="hljs-keyword">class</span> <span class="hljs-title class_">RedisBinStore</span> <span class="hljs-keyword">implements</span> <span class="hljs-title class_">BinStore</span> {
|
|
681
|
-
<span class="hljs-title function_">createBin</span>(<span class="hljs-attr">bin</span>: <span class="hljs-title class_">Bin</span>): <span class="hljs-built_in">void</span> { <span class="hljs-comment">/* SET bin:${bin.id} ... */</span> }
|
|
682
|
-
<span class="hljs-title function_">getBin</span>(<span class="hljs-attr">id</span>: <span class="hljs-built_in">string</span>): <span class="hljs-title class_">Bin</span> | <span class="hljs-literal">undefined</span> { <span class="hljs-comment">/* GET ... */</span> }
|
|
683
|
-
<span class="hljs-title function_">listBins</span>(): <span class="hljs-title class_">Bin</span>[] { <span class="hljs-comment">/* SCAN ... */</span> }
|
|
684
|
-
<span class="hljs-title function_">deleteBin</span>(<span class="hljs-attr">id</span>: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">boolean</span> { <span class="hljs-comment">/* DEL ... */</span> }
|
|
685
|
-
<span class="hljs-title function_">addRequest</span>(<span class="hljs-attr">binId</span>: <span class="hljs-built_in">string</span>, <span class="hljs-attr">req</span>: <span class="hljs-title class_">CapturedRequest</span>, <span class="hljs-attr">max</span>: <span class="hljs-built_in">number</span>): <span class="hljs-built_in">void</span> {
|
|
686
|
-
<span class="hljs-comment">/* LPUSH bin:${binId}:requests + LTRIM to max */</span>
|
|
687
|
-
}
|
|
688
|
-
<span class="hljs-title function_">getRequests</span>(<span class="hljs-attr">binId</span>: <span class="hljs-built_in">string</span>): <span class="hljs-title class_">CapturedRequest</span>[] { <span class="hljs-comment">/* LRANGE ... */</span> }
|
|
689
|
-
<span class="hljs-title function_">getRequest</span>(<span class="hljs-attr">binId</span>: <span class="hljs-built_in">string</span>, <span class="hljs-attr">reqId</span>: <span class="hljs-built_in">string</span>): <span class="hljs-title class_">CapturedRequest</span> | <span class="hljs-literal">undefined</span> { <span class="hljs-comment">/* ... */</span> }
|
|
690
|
-
<span class="hljs-title function_">clearRequests</span>(<span class="hljs-attr">binId</span>: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">void</span> { <span class="hljs-comment">/* DEL bin:${binId}:requests */</span> }
|
|
691
|
-
<span class="hljs-title function_">cleanupExpired</span>(<span class="hljs-attr">now</span>: <span class="hljs-built_in">number</span>): <span class="hljs-built_in">string</span>[] { <span class="hljs-comment">/* scan + delete */</span> <span class="hljs-keyword">return</span> []; }
|
|
692
|
-
}
|
|
726
|
+
<h3 id="storage">Storage</h3>
|
|
727
|
+
<p><code>MockHttpBins</code> stores each bin in <a href="https://github.com/jaredwray/keyv">Keyv</a> 6. The default is <code>new Keyv()</code>. That store keeps the data in memory for this process.</p>
|
|
728
|
+
<p>Pass a Keyv 6 instance when you want a different adapter. Install the adapter in your project. This package does not include an adapter. <code>@keyv/redis</code> 6 matches this Keyv version.</p>
|
|
729
|
+
<pre><code class="hljs language-typescript"><span class="hljs-keyword">import</span> <span class="hljs-title class_">Keyv</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'keyv'</span>;
|
|
730
|
+
<span class="hljs-keyword">import</span> <span class="hljs-title class_">KeyvRedis</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'@keyv/redis'</span>; <span class="hljs-comment">// pnpm add @keyv/redis</span>
|
|
731
|
+
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">MockHttpBins</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'@jaredwray/mockhttp'</span>;
|
|
693
732
|
|
|
694
|
-
mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">
|
|
733
|
+
mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">MockHttpBins</span>({
|
|
734
|
+
<span class="hljs-attr">keyv</span>: <span class="hljs-keyword">new</span> <span class="hljs-title class_">Keyv</span>({ <span class="hljs-attr">store</span>: <span class="hljs-keyword">new</span> <span class="hljs-title class_">KeyvRedis</span>(<span class="hljs-string">'redis://localhost:6379'</span>) }),
|
|
735
|
+
});
|
|
695
736
|
</code></pre>
|
|
737
|
+
<p>Each capture writes the full bin again. A large body or a high request limit makes that write large. Set <code>maxBodySize</code> and <code>maxRequestsPerBin</code> to limit the size. With the defaults, a full bin of binary bodies is about 17 MB.</p>
|
|
738
|
+
<p>Two processes that share one Keyv can lose a capture. This occurs when both processes write the same bin at the same time.</p>
|
|
739
|
+
<p>If Keyv does not store a write, the bin route returns <code>500</code> with the standard Fastify error body: <code>statusCode</code>, <code>error</code>, and <code>message</code>.</p>
|
|
740
|
+
<p>A failed read depends on the Keyv <code>error</code> listener. Without a listener, Keyv throws the store error and the route returns <code>500</code>. With a listener, Keyv does not throw. A failed read then looks like a missing bin, and the route returns <code>404</code>. <code>listBins()</code> returns only the bins that it read before the error.</p>
|
|
741
|
+
<p><code>listBins()</code> throws an error when the adapter has no iterator.</p>
|
|
742
|
+
<p>An expired bin returns 404. The in-memory Keyv store deletes an expired bin only when a read or <code>listBins()</code> reaches it. Until then, the bin stays in memory.</p>
|
|
696
743
|
</main>
|
|
697
744
|
<aside class="content-aside">
|
|
698
745
|
<h2 class="content-aside__title">TABLE OF CONTENTS</h2>
|
|
@@ -715,7 +762,7 @@ mock.<span class="hljs-property">bins</span> = <span class="hljs-keyword">new</s
|
|
|
715
762
|
<a href="https://docula.org/" target="_blank" rel="noopener noreferrer" class="footer__link" aria-label="Docula">
|
|
716
763
|
<svg class="footer__bat" xmlns="http://www.w3.org/2000/svg" viewBox="70 110 360 205" fill="currentColor"><path d="M420,173c-16.76-18-72.78-36.65-131.59-30.58A160.15,160.15,0,0,0,269,120.55c-3.78,4.52-11.15,9.45-19,9.45s-15.23-4.93-19-9.45a160.15,160.15,0,0,0-19.4,21.83C152.78,136.31,96.76,154.94,80,173c48.86,5.86,79.5,34.09,79.5,72.06,52.37,0,77,28,90.5,59.94C263.54,273,288.13,245,340.5,245,340.5,207,371.14,178.8,420,173Z"/><circle cx="239.19" cy="145.36" r="3.32" fill="#fff"/><circle cx="260.81" cy="145.36" r="3.32" fill="#fff"/></svg>
|
|
717
764
|
</a>
|
|
718
|
-
<span class="footer__updated">updated: 2026-10-
|
|
765
|
+
<span class="footer__updated">updated: 2026-10-28</span>
|
|
719
766
|
</footer>
|
|
720
767
|
<script src="/css/highlight/highlight.min.js"></script>
|
|
721
768
|
<script>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</script>
|
|
36
36
|
<title>MockHTTP - Configuration</title>
|
|
37
37
|
<script type="application/ld+json">
|
|
38
|
-
{"@context":"https://schema.org","@type":"TechArticle","headline":"Configuration","description":"","url":"https://mockhttp.org/docs/configuration/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-
|
|
38
|
+
{"@context":"https://schema.org","@type":"TechArticle","headline":"Configuration","description":"","url":"https://mockhttp.org/docs/configuration/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-28","keywords":[]}
|
|
39
39
|
</script>
|
|
40
40
|
</head>
|
|
41
41
|
|
|
@@ -544,7 +544,7 @@ GET /status/429/foo/bar
|
|
|
544
544
|
<a href="https://docula.org/" target="_blank" rel="noopener noreferrer" class="footer__link" aria-label="Docula">
|
|
545
545
|
<svg class="footer__bat" xmlns="http://www.w3.org/2000/svg" viewBox="70 110 360 205" fill="currentColor"><path d="M420,173c-16.76-18-72.78-36.65-131.59-30.58A160.15,160.15,0,0,0,269,120.55c-3.78,4.52-11.15,9.45-19,9.45s-15.23-4.93-19-9.45a160.15,160.15,0,0,0-19.4,21.83C152.78,136.31,96.76,154.94,80,173c48.86,5.86,79.5,34.09,79.5,72.06,52.37,0,77,28,90.5,59.94C263.54,273,288.13,245,340.5,245,340.5,207,371.14,178.8,420,173Z"/><circle cx="239.19" cy="145.36" r="3.32" fill="#fff"/><circle cx="260.81" cy="145.36" r="3.32" fill="#fff"/></svg>
|
|
546
546
|
</a>
|
|
547
|
-
<span class="footer__updated">updated: 2026-10-
|
|
547
|
+
<span class="footer__updated">updated: 2026-10-28</span>
|
|
548
548
|
</footer>
|
|
549
549
|
<script src="/css/highlight/highlight.min.js"></script>
|
|
550
550
|
<script>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</script>
|
|
36
36
|
<title>MockHTTP - MockHttp.org Live</title>
|
|
37
37
|
<script type="application/ld+json">
|
|
38
|
-
{"@context":"https://schema.org","@type":"TechArticle","headline":"MockHttp.org Live","description":"","url":"https://mockhttp.org/docs/hosted/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-
|
|
38
|
+
{"@context":"https://schema.org","@type":"TechArticle","headline":"MockHttp.org Live","description":"","url":"https://mockhttp.org/docs/hosted/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-28","keywords":[]}
|
|
39
39
|
</script>
|
|
40
40
|
</head>
|
|
41
41
|
|
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
</header>
|
|
294
294
|
<div class="article__body">
|
|
295
295
|
<main class="article__main">
|
|
296
|
-
<p><a href="https://mockhttp.org">mockhttp.org</a> is a free hosted instance of this codebase for testing. It runs on a <a href="/docs/how-to-deploy/cloudflare/">Cloudflare Worker</a> (no containers): documentation is served from Workers Assets, and mock APIs such as <code>/get</code> and <code>/post</code> run in the Worker. The service is globally available and rate-limited (1000 requests per minute per IP) to prevent abuse.</p>
|
|
296
|
+
<p><a href="https://mockhttp.org">mockhttp.org</a> is a free hosted instance of this codebase for testing. It runs on a <a href="/docs/how-to-deploy/cloudflare/">Cloudflare Worker</a> (no containers): documentation is served from Workers Assets, and mock APIs such as <code>/get</code> and <code>/post</code> run in the Worker. The service is globally available and rate-limited (1000 requests per minute per IP) to prevent abuse. Request bins on this service are stored in MongoDB Atlas, in the <code>bins</code> collection, so they are shared across isolates.</p>
|
|
297
297
|
<p>All <a href="https://mockhttp.org">mockhttp.org</a> traffic stays on Cloudflare. A separate test app runs the Node server on <a href="/docs/how-to-deploy/wasmer/">Wasmer Edge</a> at <a href="https://mockhttp.wasmer.app">mockhttp.wasmer.app</a>.</p>
|
|
298
298
|
<p>Getting Started is served at <code>/</code> and <code>/docs</code>, other guides at <code>/docs/...</code>, and the interactive HTTP API reference at <code>/api</code>. Mock endpoints such as <code>/get</code> and <code>/post</code> are unchanged.</p>
|
|
299
299
|
</main>
|
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
<a href="https://docula.org/" target="_blank" rel="noopener noreferrer" class="footer__link" aria-label="Docula">
|
|
319
319
|
<svg class="footer__bat" xmlns="http://www.w3.org/2000/svg" viewBox="70 110 360 205" fill="currentColor"><path d="M420,173c-16.76-18-72.78-36.65-131.59-30.58A160.15,160.15,0,0,0,269,120.55c-3.78,4.52-11.15,9.45-19,9.45s-15.23-4.93-19-9.45a160.15,160.15,0,0,0-19.4,21.83C152.78,136.31,96.76,154.94,80,173c48.86,5.86,79.5,34.09,79.5,72.06,52.37,0,77,28,90.5,59.94C263.54,273,288.13,245,340.5,245,340.5,207,371.14,178.8,420,173Z"/><circle cx="239.19" cy="145.36" r="3.32" fill="#fff"/><circle cx="260.81" cy="145.36" r="3.32" fill="#fff"/></svg>
|
|
320
320
|
</a>
|
|
321
|
-
<span class="footer__updated">updated: 2026-10-
|
|
321
|
+
<span class="footer__updated">updated: 2026-10-28</span>
|
|
322
322
|
</footer>
|
|
323
323
|
<script src="/css/highlight/highlight.min.js"></script>
|
|
324
324
|
<script>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</script>
|
|
36
36
|
<title>MockHTTP - Cloudflare</title>
|
|
37
37
|
<script type="application/ld+json">
|
|
38
|
-
{"@context":"https://schema.org","@type":"TechArticle","headline":"Cloudflare","description":"Deploy MockHTTP as a Cloudflare Worker. Workers Assets serve the docs site, and the Worker handles mock API routes.","url":"https://mockhttp.org/docs/how-to-deploy/cloudflare/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-
|
|
38
|
+
{"@context":"https://schema.org","@type":"TechArticle","headline":"Cloudflare","description":"Deploy MockHTTP as a Cloudflare Worker. Workers Assets serve the docs site, and the Worker handles mock API routes.","url":"https://mockhttp.org/docs/how-to-deploy/cloudflare/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-28","keywords":[]}
|
|
39
39
|
</script>
|
|
40
40
|
</head>
|
|
41
41
|
|
|
@@ -329,11 +329,6 @@
|
|
|
329
329
|
<td>Logos and other <code>public/</code> files are copied into <code>site/dist</code> and read through the <code>ASSETS</code> binding.</td>
|
|
330
330
|
</tr>
|
|
331
331
|
<tr>
|
|
332
|
-
<td><code>startBins</code></td>
|
|
333
|
-
<td><code>false</code></td>
|
|
334
|
-
<td>The bin cleanup timer uses <code>setInterval</code>, which can hang a Worker isolate during startup. Bin routes still register. Expired bins are removed when that bin is read, not by a sweep of every bin.</td>
|
|
335
|
-
</tr>
|
|
336
|
-
<tr>
|
|
337
332
|
<td><code>pluginTimeout</code></td>
|
|
338
333
|
<td><code>0</code></td>
|
|
339
334
|
<td>Disables Fastify's plugin boot timeout. Those timers are unreliable on Workers.</td>
|
|
@@ -350,7 +345,12 @@
|
|
|
350
345
|
</tr>
|
|
351
346
|
</tbody>
|
|
352
347
|
</table>
|
|
353
|
-
<p>The rate limiter key is the <code>cf-connecting-ip</code> header, then the first address in <code>x-forwarded-for</code>, then <code>unknown</code>. A limited request returns <code>429</code> with <code>retry-after: 60</code>. That limiter is shared across isolates
|
|
348
|
+
<p>The rate limiter key is the <code>cf-connecting-ip</code> header, then the first address in <code>x-forwarded-for</code>, then <code>unknown</code>. A limited request returns <code>429</code> with <code>retry-after: 60</code>. That limiter is shared across isolates.</p>
|
|
349
|
+
<p>Bins stay in memory in the isolate when <code>MONGODB_URI</code> is not set. A bin from one request can be absent when a different isolate handles the next request. When <code>MONGODB_URI</code> is set, bins are stored in MongoDB. Each request opens its own client on its first bin operation and closes it after the response, through <code>ctx.waitUntil</code>. No client is shared between requests: workerd rejects I/O on a socket that a different request opened, and a shared client made bin requests fail with error 1101. It does not connect while the isolate starts. Each bin request therefore pays one connection setup, which is a few round trips to Atlas.</p>
|
|
350
|
+
<p>Percent-encode reserved characters in the username and the password. <code>@</code> is <code>%40</code>. An unencoded <code>@</code> makes the driver throw <code>Invalid connection string</code> before it contacts Atlas.</p>
|
|
351
|
+
<p><code>GET /healthz</code> reports the bin store. A successful admin ping returns HTTP 200 and <code>bins.connected: true</code>. A failed ping returns HTTP 503 with the driver error name, a redacted message, and a code. The body has <code>uriPresent</code> (boolean). It does not have the scheme. On the Node server, this route reports the memory store.</p>
|
|
352
|
+
<p>When <code>MONGODB_URI</code> is set, <code>bins.uri</code> has the URI length and the <code>@</code> count. It also has flags for whitespace, a newline, and quote marks. It does not have the host, the username, or the password length. The body does not have the password or the full URI.</p>
|
|
353
|
+
<p>The percent-encode hint is added only for <code>Invalid connection string</code> or <code>unescaped characters</code>. A DNS error keeps the driver text. <code>uri.passwordReserved</code> is empty when the password has only reserved characters. Worker logs still omit the URI, the username, the password, and the host.</p>
|
|
354
354
|
<p>Taps are a library API (<code>mock.taps.inject</code>). They have no HTTP routes, so a deployed Worker has no way to inject one.</p>
|
|
355
355
|
<p>Assets are checked before the Worker. A file under <code>site/dist</code> (the docs site, favicon, logos) is served as a static asset. A path that is not a file, such as <code>/get</code> or <code>/post</code>, is handled by the Worker.</p>
|
|
356
356
|
<h2 id="deploy-your-own-worker">Deploy your own Worker</h2>
|
|
@@ -390,7 +390,7 @@ npx wrangler@4.127.0 deploy
|
|
|
390
390
|
<a href="https://docula.org/" target="_blank" rel="noopener noreferrer" class="footer__link" aria-label="Docula">
|
|
391
391
|
<svg class="footer__bat" xmlns="http://www.w3.org/2000/svg" viewBox="70 110 360 205" fill="currentColor"><path d="M420,173c-16.76-18-72.78-36.65-131.59-30.58A160.15,160.15,0,0,0,269,120.55c-3.78,4.52-11.15,9.45-19,9.45s-15.23-4.93-19-9.45a160.15,160.15,0,0,0-19.4,21.83C152.78,136.31,96.76,154.94,80,173c48.86,5.86,79.5,34.09,79.5,72.06,52.37,0,77,28,90.5,59.94C263.54,273,288.13,245,340.5,245,340.5,207,371.14,178.8,420,173Z"/><circle cx="239.19" cy="145.36" r="3.32" fill="#fff"/><circle cx="260.81" cy="145.36" r="3.32" fill="#fff"/></svg>
|
|
392
392
|
</a>
|
|
393
|
-
<span class="footer__updated">updated: 2026-10-
|
|
393
|
+
<span class="footer__updated">updated: 2026-10-28</span>
|
|
394
394
|
</footer>
|
|
395
395
|
<script src="/css/highlight/highlight.min.js"></script>
|
|
396
396
|
<script>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</script>
|
|
36
36
|
<title>MockHTTP - Docker</title>
|
|
37
37
|
<script type="application/ld+json">
|
|
38
|
-
{"@context":"https://schema.org","@type":"TechArticle","headline":"Docker","description":"Run MockHTTP from the jaredwray/mockhttp image, with Docker Compose, or by building the image from this repository.","url":"https://mockhttp.org/docs/how-to-deploy/docker/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-
|
|
38
|
+
{"@context":"https://schema.org","@type":"TechArticle","headline":"Docker","description":"Run MockHTTP from the jaredwray/mockhttp image, with Docker Compose, or by building the image from this repository.","url":"https://mockhttp.org/docs/how-to-deploy/docker/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-28","keywords":[]}
|
|
39
39
|
</script>
|
|
40
40
|
</head>
|
|
41
41
|
|
|
@@ -399,7 +399,7 @@ docker run -d -p 3000:3000 jaredwray/mockhttp
|
|
|
399
399
|
<a href="https://docula.org/" target="_blank" rel="noopener noreferrer" class="footer__link" aria-label="Docula">
|
|
400
400
|
<svg class="footer__bat" xmlns="http://www.w3.org/2000/svg" viewBox="70 110 360 205" fill="currentColor"><path d="M420,173c-16.76-18-72.78-36.65-131.59-30.58A160.15,160.15,0,0,0,269,120.55c-3.78,4.52-11.15,9.45-19,9.45s-15.23-4.93-19-9.45a160.15,160.15,0,0,0-19.4,21.83C152.78,136.31,96.76,154.94,80,173c48.86,5.86,79.5,34.09,79.5,72.06,52.37,0,77,28,90.5,59.94C263.54,273,288.13,245,340.5,245,340.5,207,371.14,178.8,420,173Z"/><circle cx="239.19" cy="145.36" r="3.32" fill="#fff"/><circle cx="260.81" cy="145.36" r="3.32" fill="#fff"/></svg>
|
|
401
401
|
</a>
|
|
402
|
-
<span class="footer__updated">updated: 2026-10-
|
|
402
|
+
<span class="footer__updated">updated: 2026-10-28</span>
|
|
403
403
|
</footer>
|
|
404
404
|
<script src="/css/highlight/highlight.min.js"></script>
|
|
405
405
|
<script>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</script>
|
|
36
36
|
<title>MockHTTP - Wasmer</title>
|
|
37
37
|
<script type="application/ld+json">
|
|
38
|
-
{"@context":"https://schema.org","@type":"TechArticle","headline":"Wasmer","description":"Deploy the MockHTTP Node.js server to Wasmer Edge with app.yaml, Anybuild, and wasmer deploy.","url":"https://mockhttp.org/docs/how-to-deploy/wasmer/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-
|
|
38
|
+
{"@context":"https://schema.org","@type":"TechArticle","headline":"Wasmer","description":"Deploy the MockHTTP Node.js server to Wasmer Edge with app.yaml, Anybuild, and wasmer deploy.","url":"https://mockhttp.org/docs/how-to-deploy/wasmer/","publisher":{"@type":"Organization","name":"MockHTTP"},"dateModified":"2026-10-28","keywords":[]}
|
|
39
39
|
</script>
|
|
40
40
|
</head>
|
|
41
41
|
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
<h2 id="build-with-anybuild">Build with Anybuild</h2>
|
|
321
321
|
<p><a href="https://github.com/jaredwray/mockhttp/blob/main/Anybuild"><code>Anybuild</code></a> tells Wasmer how to build the package on a remote builder:</p>
|
|
322
322
|
<ul>
|
|
323
|
-
<li>Node.js 24 and pnpm <code>12.
|
|
323
|
+
<li>Node.js 24 and pnpm <code>12.12.1</code></li>
|
|
324
324
|
<li>Build command: <code>pnpm run build && pnpm website:build</code></li>
|
|
325
325
|
<li>Start command: <code>node dist/index.mjs</code></li>
|
|
326
326
|
</ul>
|
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
<pre><code class="hljs language-bash">wasmer deploy --non-interactive --build-remote
|
|
336
336
|
</code></pre>
|
|
337
337
|
<h2 id="runtime-behavior">Runtime behavior</h2>
|
|
338
|
-
<p>Bins use
|
|
338
|
+
<p>Bins use <code>new Keyv()</code> by default. The store keeps each bin in memory on the instance that created it. Give <code>MockHttpBins</code> a shared Keyv when bins must be visible on more than one instance. Two processes can lose a capture when they write the same bin at the same time. Taps are a library API (<code>mock.taps.inject</code>) and have no HTTP routes, so a deployed app cannot inject one.</p>
|
|
339
339
|
<p><code>@fastify/rate-limit</code> is on at 1000 requests per minute. It keys on the address that connects to the process. The server does not trust proxy headers, and the allow list is only <code>127.0.0.1</code> and <code>::1</code>. On the test app, <code>/ip</code> reports <code>127.0.0.100</code>, which is the edge proxy rather than the caller, and the response includes <code>x-ratelimit-limit: 1000</code>. Clients that share that proxy address share one limit on that instance. This is not the Cloudflare limiter used by <a href="https://mockhttp.org">mockhttp.org</a>.</p>
|
|
340
340
|
<p>The process listens with HTTP. Wasmer terminates TLS for the <code>*.wasmer.app</code> hostname.</p>
|
|
341
341
|
</main>
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
<a href="https://docula.org/" target="_blank" rel="noopener noreferrer" class="footer__link" aria-label="Docula">
|
|
361
361
|
<svg class="footer__bat" xmlns="http://www.w3.org/2000/svg" viewBox="70 110 360 205" fill="currentColor"><path d="M420,173c-16.76-18-72.78-36.65-131.59-30.58A160.15,160.15,0,0,0,269,120.55c-3.78,4.52-11.15,9.45-19,9.45s-15.23-4.93-19-9.45a160.15,160.15,0,0,0-19.4,21.83C152.78,136.31,96.76,154.94,80,173c48.86,5.86,79.5,34.09,79.5,72.06,52.37,0,77,28,90.5,59.94C263.54,273,288.13,245,340.5,245,340.5,207,371.14,178.8,420,173Z"/><circle cx="239.19" cy="145.36" r="3.32" fill="#fff"/><circle cx="260.81" cy="145.36" r="3.32" fill="#fff"/></svg>
|
|
362
362
|
</a>
|
|
363
|
-
<span class="footer__updated">updated: 2026-10-
|
|
363
|
+
<span class="footer__updated">updated: 2026-10-28</span>
|
|
364
364
|
</footer>
|
|
365
365
|
<script src="/css/highlight/highlight.min.js"></script>
|
|
366
366
|
<script>
|