You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, the ALLOW list is global and meant to be set in initialization. We have some very good reasons we want to dynamically allow and disallow some hosts, namely with only a few tests needing to hit that endpoint, and not wanting others to do it accidentally.
I would be game to add the APIs myself for this, but I wanted to confirm that you are good with my approach first before I put in the time.
Proposal
Leave the existing WebMock.disable_net_connect!(allow:) declaration unaltered fully
Add a new `WebMock.with_allowed_connections(*allowed)
That block method would set a thread-local var of the local allowances, and remove it in an ensure
Replace the addr_accessor for allow on config with a version that joins the static variable with the thread variable
Workaround
The alternative I see is a workaround of using a proc as an arg to the static allow list, and having that check the Thread.current store for additional values and comparing. That is what I am about to do for now, but it feels pretty janky.
The text was updated successfully, but these errors were encountered:
Right now, the
ALLOW
list is global and meant to be set in initialization. We have some very good reasons we want to dynamically allow and disallow some hosts, namely with only a few tests needing to hit that endpoint, and not wanting others to do it accidentally.I would be game to add the APIs myself for this, but I wanted to confirm that you are good with my approach first before I put in the time.
Proposal
WebMock.disable_net_connect!(allow:)
declaration unaltered fullyallow
on config with a version that joins the static variable with the thread variableWorkaround
The alternative I see is a workaround of using a proc as an arg to the static allow list, and having that check the Thread.current store for additional values and comparing. That is what I am about to do for now, but it feels pretty janky.
The text was updated successfully, but these errors were encountered: