diff --git a/.changeset/hip-ravens-teach.md b/.changeset/hip-ravens-teach.md new file mode 100644 index 00000000..37c6b4e0 --- /dev/null +++ b/.changeset/hip-ravens-teach.md @@ -0,0 +1,5 @@ +--- +"counterfact": minor +--- + +turn the proxy on or off for individual paths diff --git a/docs/usage.md b/docs/usage.md index 4b0f686a..c0fd3681 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -282,11 +282,9 @@ To proxy an individual endpoint, you can use the `$.proxy()` function. }; ``` -To toggle globally between Counterfact and a proxy server, pass `--proxy-url ` in the CLI. +To set up a proxy for the entire API, add `--proxy ` in the CLI. -Then type `.proxy on` / `.proxy off` in the REPL to turn it on and off. When the global proxy is on, all requests will be sent to the proxy URL instead of the mock implementations in Counterfact. - -This feature is hot off the presses and somewhat experimental. We have plans to introduce more granular controls over what gets proxied when, but we want to see how this works first. Please send feedback! +From there, you can switch back and forth between the proxy and mocks by typing `.proxy [on|off] `. Type `.proxy help` for detailed information on using the `.proxy` command. ## No Cap Recap 🧢 diff --git a/src/repl/repl.ts b/src/repl/repl.ts index fa78add4..b0bfcc18 100644 --- a/src/repl/repl.ts +++ b/src/repl/repl.ts @@ -104,7 +104,7 @@ export function startRepl( action(text) { if (text === "help" || text === "") { print(".proxy [on|off] - turn the proxy on/off at the root level"); - print(".proxy [on|off] - turn the proxy on for a path"); + print(".proxy [on|off] - turn the proxy on for a path"); print(".proxy status - show the proxy status"); print(".proxy help - show this message"); } else if (text.startsWith("url")) { diff --git a/test/repl/repl.test.ts b/test/repl/repl.test.ts index b33443a2..cd1a4f72 100644 --- a/test/repl/repl.test.ts +++ b/test/repl/repl.test.ts @@ -191,7 +191,7 @@ describe("REPL", () => { expect(harness.output).toEqual([ ".proxy [on|off] - turn the proxy on/off at the root level", - ".proxy [on|off] - turn the proxy on for a path", + ".proxy [on|off] - turn the proxy on for a path", ".proxy status - show the proxy status", ".proxy help - show this message", ]);