Skip to content

proposal: net/http: add HTTP transport interceptors #66844

Closed as not planned
Closed as not planned
@ngochd7

Description

@ngochd7

Proposal Details

Proposed new Transport Interceptor Api for net/http package.
It helps users easily install hooks/filters/custom_actions into their Http Client.
A few use cases that I'm using and that I think are useful to a lot of people:

  • Block calls to unwanted hosts.
  • Add default header for all requests.
  • Intercept the Http Request to the destination and send the Mock Http Response to the user. (Useful for Testing)
  • Collect complete information about the Request and Response of every Http Request.
  • ...

I have written a few typical Interceptors here, you can see it is quite clear so users can easily use and create their Interceptors.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions