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
tl;dr WebMockHTTPClients#do_get returns HTTP::Message in some cases, and Queue::Thread in other cases. This does is fine in most cases because the return value is generally ignored when callbacks are expected to run, but breaks things in applications with other gems that modify HTTP::Client, such as ddtrace.
It seems reasonable to assume that this isn't generally an issue because tests that stub requests will see callbacks invoked and discard the return type, and because ddtrace may not be enabled in test environments. (Though some may have it enabled to better mirror production environments and simply filter all traces.)
My understanding of HTTP::Client is limited, so I may be understanding this problem incorrectly. However, the inconsistent return type breaks seems like it may be unintentional, and breaks ddtrace when enabled in the same environment as webmock.
(fwiw, if the return value is nil, ddtrace gracefully ignores the request.)
The text was updated successfully, but these errors were encountered:
@thelowlypeon Thank you for reporting. Do I understand that the issue only occurs when ddtrace is enabled? Is this still an issue with recent versions of ddtrace?
tl;dr
WebMockHTTPClients#do_get
returnsHTTP::Message
in some cases, andQueue::Thread
in other cases. This does is fine in most cases because the return value is generally ignored when callbacks are expected to run, but breaks things in applications with other gems that modifyHTTP::Client
, such as ddtrace.If the request is mocked, webmock runs this:
We can see that the return value is
res
, which is the return value ofconn.push(response)
, which is aThread::Queue
.However, if the request is not mocked (and net connect is allowed), webmock will return an
HTTP::Message
, as HTTP::Client does:It seems reasonable to assume that this isn't generally an issue because tests that stub requests will see callbacks invoked and discard the return type, and because ddtrace may not be enabled in test environments. (Though some may have it enabled to better mirror production environments and simply filter all traces.)
My understanding of
HTTP::Client
is limited, so I may be understanding this problem incorrectly. However, the inconsistent return type breaks seems like it may be unintentional, and breaks ddtrace when enabled in the same environment as webmock.(fwiw, if the return value is
nil
, ddtrace gracefully ignores the request.)The text was updated successfully, but these errors were encountered: