This optional parameter defines a Perl hook for pre-processing
HTTP server responses. Defaults to not set. The hook is passed the
following arguments:
- Reference to a hash with server response and response related
information
MapResponseHook has full access to a complete server response.
This allows the hook to do any local modifications that are
needed.
# Do some pre-processing before passing response to upper layers.
MapResponseHook file:"%D/http-map-response-hook.pl"
Here's an
example of how to update a decoded JSON array response to a format
described by
AuthBy
REST
.
# Replace an array reference with the array's first member
# Received JSON: [ { "a1": 1 }, { "b2": 2 }]
# AuthBy REST needs just the first object, the one with key "a1"
<AuthBy REST>
# Parameters, location within AuthBy does not matter
MapResponseHook sub { $_[0]->{server_response} = $_[0]->{server_response}->[0]; }
# More parameters
</AuthBy>