Class: AgileProxy::Servers::RequestSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/agile_proxy/servers/request_spec.rb

Overview

The ‘Request Spec’ server This server is responsible for handling or passing through a request, depending on if it has a matching ‘Request Specification’

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRequestSpec

Returns a new instance of RequestSpec.



16
17
18
# File 'lib/agile_proxy/servers/request_spec.rb', line 16

def initialize
  @request_handler = AgileProxy::RequestHandler.new
end

Class Method Details

.startObject

Starts the server



13
14
15
# File 'lib/agile_proxy/servers/request_spec.rb', line 13

def self.start
  new.start
end

Instance Method Details

#portInteger

The port the server is running on

Returns:

  • (Integer)

    The port the server is running on



34
35
36
# File 'lib/agile_proxy/servers/request_spec.rb', line 34

def port
  return AgileProxy.config.proxy_port
end

#startObject

Starts the server



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/agile_proxy/servers/request_spec.rb', line 20

def start
  #
  # The API runner
  runner = ::Goliath::Proxy::Runner.new([], nil)
  runner.address = '127.0.0.1'
  runner.port = AgileProxy.config.proxy_port
  app = @request_handler
  runner.app = app
  runner.run
  self

end