Adding output handler logic to accept either query parameters or request headers.