httpx icon indicating copy to clipboard operation
httpx copied to clipboard

Extend the scope matchers and extractors to include response headers

Open fail-open opened this issue 2 years ago • 1 comments

Please describe your feature request:

Currently, matchers/extractors are limited to a response body that can be extended to include response headers as well.

Describe the use case of this feature:

In an effort to extract authentication methods in bulk, I frequently collect headers and parse out the www-authenticate header. It would be great if this extracted type (basic, digest Bearer) and any additional info (realm etc).

fail-open avatar Aug 09 '22 15:08 fail-open

Currently extractors only work on the response body. We could easily extend this to also consider the response headers (or even the same for requests).

Other options:

  • add a dedicated flag that would control the scope for matchers and extractors
  • create separate flags for request headers, request body and response headers

This request should potentially affect or would require extension of the following flags:

  • [x] -match-string
  • [x] -match-regex
  • [x] -extract-regex
  • [x] -extract-preset

Documentation has to created/updated.

forgedhallpass avatar Aug 11 '22 10:08 forgedhallpass

The linked PR might not handle all the cases mentioned in this ticket.

forgedhallpass avatar Oct 01 '22 14:10 forgedhallpass