Skip to content

Add response extractor

Compare
Choose a tag to compare
@MicahParks MicahParks released this 27 Sep 00:08
f20aea8

Edit: This release has been retracted due to a bug in ResponseExtractorStatusOK not closing the response body. Please upgrade to v1.4.0.

The purpose of this release is to allow for custom HTTP response extractors. A response extractor is responsible for consuming an *http.Response and producing the raw JWK Set JSON. It is also responsible for closing the body of the *http.Response.

I plan on following up this release with v1.3.1 soon. This upcoming release will change the default behavior of how the package handles HTTP response codes, returning a non-nil error in cases such as a 500 HTTP response code.

New additions:

  • keyfunc.Options has a new field named ResponseExtractor that, when provided, is responsible for the behavior described above.
  • keyfunc.ResponseExtractorStatusOK is a helper function to fit into the ResponseExtractor field in keyfunc.Options.

Relevant pull requests:

Relevant issues: