From bb966a9809995228385658790d71687f1efffd3a Mon Sep 17 00:00:00 2001 From: Josh Twist Date: Mon, 18 Dec 2023 05:58:25 -0800 Subject: [PATCH] Update doc.md (#288) * Update doc.md * Update doc.md --- policies/custom-code-outbound/doc.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/policies/custom-code-outbound/doc.md b/policies/custom-code-outbound/doc.md index 98b6b23a..b7692684 100644 --- a/policies/custom-code-outbound/doc.md +++ b/policies/custom-code-outbound/doc.md @@ -1,4 +1,10 @@ -## Writing A Policy +:::tip +The outbound policy will only execute if the response status code is 'ok' +(e.g. `response.ok === true` or the status code is 200-299) - see +[response.ok on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Response/ok). +::: + +### Writing A Policy Custom policies can be written to extend the functionality of your gateway. This document is about outbound policies that can intercept the request and, if @@ -99,7 +105,7 @@ that same instance you must first `clone()` to avoid runtime errors such as ::: -## Adding headers +### Adding headers Note if you just need to add headers, it more efficient not read the body stream and reuse it, e.g.