pacto 0.4.0.rc2 → 0.4.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pacto/version.rb +1 -1
- data/pacto-server.gemspec +1 -1
- metadata +2 -3
- data/lib/pacto/server.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38d24b3fb7d02cdcd41a64b03c833a67242de106
|
4
|
+
data.tar.gz: ce8e0781581173111246ad51a0b34ad041faa5c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2b10913f465143aa3e74527d193d946ab31ad8fad9e3d2f949036840f47a26785659dc39a8df10663053d307cea8f2afdbe6bb1cafbd5ee467d764faae93f89
|
7
|
+
data.tar.gz: 5edf31b8a835c35ac60718ca97c51be7bda101930016b9eb2824d232be0e44b43970f2860dc0491358c27c004754c1e4689c0ade3df9e5f30f83dbf049519518
|
data/lib/pacto/version.rb
CHANGED
data/pacto-server.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.homepage = 'http://thoughtworks.github.io/pacto/'
|
13
13
|
gem.license = 'MIT'
|
14
14
|
|
15
|
-
gem.files = `git ls-files -- bin/pacto-server lib/pacto/server`.split($/) # rubocop:disable SpecialGlobalVars
|
15
|
+
gem.files = `git ls-files -- bin/pacto-server lib/pacto/server.rb lib/pacto/server`.split($/) # rubocop:disable SpecialGlobalVars
|
16
16
|
gem.executables = gem.files.grep(/^bin\//).map { |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(/^(test|spec|features)\//)
|
18
18
|
gem.require_paths = ['lib']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.0.
|
4
|
+
version: 0.4.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ThoughtWorks & Abril
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webmock
|
@@ -513,7 +513,6 @@ files:
|
|
513
513
|
- lib/pacto/resettable.rb
|
514
514
|
- lib/pacto/response_clause.rb
|
515
515
|
- lib/pacto/rspec.rb
|
516
|
-
- lib/pacto/server.rb
|
517
516
|
- lib/pacto/stubs/uri_pattern.rb
|
518
517
|
- lib/pacto/stubs/webmock_adapter.rb
|
519
518
|
- lib/pacto/test_helper.rb
|
data/lib/pacto/server.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'reel'
|
3
|
-
require 'pacto'
|
4
|
-
require_relative 'server/settings'
|
5
|
-
require_relative 'server/proxy'
|
6
|
-
|
7
|
-
module Pacto
|
8
|
-
module Server
|
9
|
-
class HTTP < Reel::Server::HTTP
|
10
|
-
attr_reader :settings, :logger
|
11
|
-
include Proxy
|
12
|
-
|
13
|
-
def initialize(host = '127.0.0.1', port = 3000, options = {})
|
14
|
-
@logger = options[:pacto_logger] || Pacto.configuration.logger
|
15
|
-
@settings = Settings::OptionHandler.new(port, @logger).handle(options)
|
16
|
-
logger.info "Pacto Server starting on #{host}:#{port}"
|
17
|
-
super(host, port, spy: options[:spy], &method(:on_connection))
|
18
|
-
end
|
19
|
-
|
20
|
-
def on_connection(connection)
|
21
|
-
# Support multiple keep-alive requests per connection
|
22
|
-
connection.each_request do |reel_request|
|
23
|
-
begin
|
24
|
-
pacto_request = # exclusive do
|
25
|
-
Pacto::PactoRequest.new(
|
26
|
-
headers: reel_request.headers, body: reel_request.read,
|
27
|
-
method: reel_request.method, uri: Addressable::URI.heuristic_parse(reel_request.uri)
|
28
|
-
)
|
29
|
-
# end
|
30
|
-
|
31
|
-
pacto_response = proxy_request(pacto_request)
|
32
|
-
reel_response = ::Reel::Response.new(pacto_response.status, pacto_response.headers, pacto_response.body)
|
33
|
-
reel_request.respond(reel_response)
|
34
|
-
rescue WebMock::NetConnectNotAllowedError, Faraday::ConnectionFailed => e
|
35
|
-
reel_request.respond 502, e.message
|
36
|
-
rescue => e
|
37
|
-
reel_request.respond 500, Pacto::Errors.formatted_trace(e)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|