Skip to content

Add additional headers on request #1634

@dostaglou

Description

@dostaglou

Is your feature request related to a problem? Please describe.

Problem being solved: for an internal compliance requirement, I am required to provide a custom hmac header to outbound requests including ones handled by the Stripe gem.

Describe the solution you'd like

A hook we can integrate with during initialization of Stripe that allows our system to alter the request directly. In this case, add additional headers after inspecting the body content and URI.

Describe alternatives you've considered

If a hook for adding headers to the request is unavailable, simply moving the request building to its own method would enable a more narrow monkey patch and this part of the logic is far less likely to see changes in future updates thus providing some extra stability.

Currently we are looking to monkey patch Stripe::ConnectionManager#execute_request. In particular, right before Net::HTTPGenericRequest.new is executed, we add our own header content.

Additional context

If there exists a solution to this problem already, I would also greatly appreciate being pointed to it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions