From 62c4e3658c5db8565a1dece4d6922bfb81cb0c94 Mon Sep 17 00:00:00 2001 From: Tim Rowe Date: Sat, 18 Jan 2025 09:59:46 +1100 Subject: [PATCH 1/5] Add clarification on onRequest call fall-thgouth Adds clarification that the onRequest function will not be called if another matching function is found. --- src/content/docs/pages/functions/api-reference.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/pages/functions/api-reference.mdx b/src/content/docs/pages/functions/api-reference.mdx index 93458b542eacf9..8df10c44307c7d 100644 --- a/src/content/docs/pages/functions/api-reference.mdx +++ b/src/content/docs/pages/functions/api-reference.mdx @@ -14,10 +14,10 @@ The following methods can be used to configure your Pages Function. ### `onRequests` - +`onRequest` will be called *unless* a more specific `onRequestVerb` method is exported. For example if both `onRequest` and `onRequestGet` are exported, the `onRequest` method will not be called for matching `GET` requests. * onRequest(context[EventContext](#eventcontext)) Response | Promise\ - * This function will be invoked on all requests no matter the request method. + * This function will be invoked on all requests no matter the request method, if no specific request verb method below is exported. It will not be called if `next(context.request)` is called from a `onRquestVerb function`. * onRequestGet(context[EventContext](#eventcontext)) Response | Promise\ * This function will be invoked on all `GET` requests. * onRequestPost(context[EventContext](#eventcontext)) Response | Promise\ From 9601ab7262b7df8a70fe78fd1bbd45669a6467f1 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Wed, 19 Mar 2025 10:55:53 +0000 Subject: [PATCH 2/5] Update src/content/docs/pages/functions/api-reference.mdx --- src/content/docs/pages/functions/api-reference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/api-reference.mdx b/src/content/docs/pages/functions/api-reference.mdx index 8df10c44307c7d..8316d93abbfe49 100644 --- a/src/content/docs/pages/functions/api-reference.mdx +++ b/src/content/docs/pages/functions/api-reference.mdx @@ -14,7 +14,7 @@ The following methods can be used to configure your Pages Function. ### `onRequests` -`onRequest` will be called *unless* a more specific `onRequestVerb` method is exported. For example if both `onRequest` and `onRequestGet` are exported, the `onRequest` method will not be called for matching `GET` requests. +`onRequest` will be called unless a more specific `onRequestVerb` method is exported. For example, if both `onRequest` and `onRequestGet` are exported, only `onRequestGet` will be called for `GET` requests. * onRequest(context[EventContext](#eventcontext)) Response | Promise\ * This function will be invoked on all requests no matter the request method, if no specific request verb method below is exported. It will not be called if `next(context.request)` is called from a `onRquestVerb function`. From db9875d024a8f555403e2580cbb48b5bb9438a9b Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Wed, 19 Mar 2025 10:56:02 +0000 Subject: [PATCH 3/5] Update src/content/docs/pages/functions/api-reference.mdx --- src/content/docs/pages/functions/api-reference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/api-reference.mdx b/src/content/docs/pages/functions/api-reference.mdx index 8316d93abbfe49..acbbffac7c3091 100644 --- a/src/content/docs/pages/functions/api-reference.mdx +++ b/src/content/docs/pages/functions/api-reference.mdx @@ -17,7 +17,7 @@ The following methods can be used to configure your Pages Function. `onRequest` will be called unless a more specific `onRequestVerb` method is exported. For example, if both `onRequest` and `onRequestGet` are exported, only `onRequestGet` will be called for `GET` requests. * onRequest(context[EventContext](#eventcontext)) Response | Promise\ - * This function will be invoked on all requests no matter the request method, if no specific request verb method below is exported. It will not be called if `next(context.request)` is called from a `onRquestVerb function`. + * This function will be invoked on all requests no matter what the request method is, as long as no specific request verb (like one of the methods below) is exported. It also won't be invoked if `next(context.request)` is called from a `onRequestVerb` function. * onRequestGet(context[EventContext](#eventcontext)) Response | Promise\ * This function will be invoked on all `GET` requests. * onRequestPost(context[EventContext](#eventcontext)) Response | Promise\ From 67d837793ea2c0634eca078c925c3f7373e33753 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Wed, 19 Mar 2025 10:57:26 +0000 Subject: [PATCH 4/5] Update src/content/docs/pages/functions/api-reference.mdx --- src/content/docs/pages/functions/api-reference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/api-reference.mdx b/src/content/docs/pages/functions/api-reference.mdx index acbbffac7c3091..56b777318a4b60 100644 --- a/src/content/docs/pages/functions/api-reference.mdx +++ b/src/content/docs/pages/functions/api-reference.mdx @@ -14,7 +14,7 @@ The following methods can be used to configure your Pages Function. ### `onRequests` -`onRequest` will be called unless a more specific `onRequestVerb` method is exported. For example, if both `onRequest` and `onRequestGet` are exported, only `onRequestGet` will be called for `GET` requests. +The `onRequest` method will be called unless a more specific `onRequestVerb` method is exported. For example, if both `onRequest` and `onRequestGet` are exported, only `onRequestGet` will be called for `GET` requests. * onRequest(context[EventContext](#eventcontext)) Response | Promise\ * This function will be invoked on all requests no matter what the request method is, as long as no specific request verb (like one of the methods below) is exported. It also won't be invoked if `next(context.request)` is called from a `onRequestVerb` function. From 95f1c8834b8b52ef549a11d90cbd7aca47490665 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Mon, 31 Mar 2025 16:23:00 +0100 Subject: [PATCH 5/5] Update src/content/docs/pages/functions/api-reference.mdx Co-authored-by: Greg Brimble --- src/content/docs/pages/functions/api-reference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/functions/api-reference.mdx b/src/content/docs/pages/functions/api-reference.mdx index 56b777318a4b60..c0be67b7c32c5a 100644 --- a/src/content/docs/pages/functions/api-reference.mdx +++ b/src/content/docs/pages/functions/api-reference.mdx @@ -17,7 +17,7 @@ The following methods can be used to configure your Pages Function. The `onRequest` method will be called unless a more specific `onRequestVerb` method is exported. For example, if both `onRequest` and `onRequestGet` are exported, only `onRequestGet` will be called for `GET` requests. * onRequest(context[EventContext](#eventcontext)) Response | Promise\ - * This function will be invoked on all requests no matter what the request method is, as long as no specific request verb (like one of the methods below) is exported. It also won't be invoked if `next(context.request)` is called from a `onRequestVerb` function. + * This function will be invoked on all requests no matter what the request method is, as long as no specific request verb (like one of the methods below) is exported. * onRequestGet(context[EventContext](#eventcontext)) Response | Promise\ * This function will be invoked on all `GET` requests. * onRequestPost(context[EventContext](#eventcontext)) Response | Promise\