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



165
166
167
168
169
170
# File 'lib/httpx/adapters/webmock.rb', line 165

def disable!
  return unless @original_session

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

.enable!Object



156
157
158
159
160
161
162
163
# File 'lib/httpx/adapters/webmock.rb', line 156

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