laravel-http-client-logger icon indicating copy to clipboard operation
laravel-http-client-logger copied to clipboard

Filtering data based on keys not values

Open bilfeldt opened this issue 4 years ago • 1 comments
trafficstars

It should be possible to provide an array of headers to filter, an array of query parameters to filter and body parameters to remove (last two could be combined to one payload array) - note that this can be individual for request and response:

Http::log([], // No context added
    [
        'filter_request_headers' => [
            'user-agent',
        ],
        'filter_request_payload' => [
            'apitoken', // remove any "apitoken" provided in either request json or query
        ],
        'filter_response_payload' => [
            'data.*.base64_pdf',
        ],
    ]
)->get(...)

bilfeldt avatar Nov 12 '21 23:11 bilfeldt

I suggest using a dedicated logger using logWith and the new MessageAccessor that were both introduced in v1.1.0 - see #13 and #15

bilfeldt avatar Dec 18 '21 23:12 bilfeldt