Class: WebMock::HttpLibAdapters::HttpxAdapter

Inherits:
HttpLibAdapter
  • Object
show all
Defined in:
lib/httpx/adapters/webmock.rb

Class Method Summary collapse

Class Method Details

.disable! ⇒ Object



194
195
196
197
198
199
# File 'lib/httpx/adapters/webmock.rb', line 194

def disable!
  return unless @original_session

  HTTPX.send(:remove_const, :Session)
  HTTPX.send(:const_set, :Session, @original_session)
end

.enable! ⇒ Object



185
186
187
188
189
190
191
192
# File 'lib/httpx/adapters/webmock.rb', line 185

def enable!
  @original_session ||= HTTPX::Session

  webmock_session = HTTPX.plugin(Plugin)

  HTTPX.send(:remove_const, :Session)
  HTTPX.send(:const_set, :Session, webmock_session.class)
end