On Origin Request Hook
The onOriginRequest
hook is called whenever the resolver needs to call a remote service. It can be enabled for all Operations, or for specific ones. Using this hook, you're able to completely rewrite the request, headers, etc.
This hook is useful, e.g. when you'd like to sign requests or when you have to get a one time short-lived access token.
Similar to all other hooks, the customResolve
hook is called with the following parameters:
user
: The user object when the user is authenticatedclientRequest
: The original client request object, including Headerslog
: The logger objectinternalClient
: The internal client objectresponse
: The response object (only for postResolve hooks)input
: The input object (only for Operation hooks)
With the internalClient
, you're able to securely call into all defined Operations, e.g. to talk to a database or another service to enrich a response or manipulate the inputs of an Operation.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17