browsermob-proxy 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/browsermob-proxy.gemspec +1 -1
- data/lib/browsermob/proxy/client.rb +8 -0
- data/lib/browsermob/proxy/version.rb +1 -1
- data/lib/browsermob/proxy/webdriver_listener.rb +2 -0
- data/spec/e2e/selenium_spec.rb +14 -0
- data/spec/unit/client_spec.rb +13 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4746a40da8079c78653f63bf05ac1be1edfa6ca5
|
4
|
+
data.tar.gz: f46530ae50096d7454c8be71cb0e0ef8dc52893c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8194f92c4ec9ec9e8fcb68b5fc41af88ef227b38e0a1da8fffcf24fe7593cb48b5ceed9bb5a0308cde0df5adeef3a48afa4742cd2c6ae668b5546cdaba74ec1
|
7
|
+
data.tar.gz: 4a35dda92ad80928bda64c2cf4d1adc298e4a0479233494fa436fdc232517a8ae24bbf96c56770a877337d16e44b0543a5eaf1b0c16ce76a078e7836a995985f
|
data/browsermob-proxy.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_runtime_dependency "multi_json", "~> 1.0"
|
21
21
|
s.add_runtime_dependency "har"
|
22
22
|
|
23
|
-
s.add_development_dependency "rspec", "
|
23
|
+
s.add_development_dependency "rspec", "~> 2.0"
|
24
24
|
s.add_development_dependency "selenium-webdriver", "~> 2.7"
|
25
25
|
s.add_development_dependency "rake", "~> 0.9.2"
|
26
26
|
s.add_development_dependency "rack", "~> 1.5"
|
@@ -198,6 +198,14 @@ module BrowserMob
|
|
198
198
|
def close
|
199
199
|
@resource.delete
|
200
200
|
end
|
201
|
+
|
202
|
+
def request_interceptor=(data)
|
203
|
+
@resource['interceptor/request'].post data, :content_type => "text/plain"
|
204
|
+
end
|
205
|
+
|
206
|
+
def response_interceptor=(data)
|
207
|
+
@resource['interceptor/response'].post data, :content_type => "text/plain"
|
208
|
+
end
|
201
209
|
end # Client
|
202
210
|
|
203
211
|
end # Proxy
|
@@ -21,6 +21,8 @@ module BrowserMob
|
|
21
21
|
|
22
22
|
@new_har_opts = {}
|
23
23
|
@new_har_opts[:capture_headers] = true if opts[:capture_headers]
|
24
|
+
@new_har_opts[:capture_content] = true if opts[:capture_content]
|
25
|
+
@new_har_opts[:capture_binary_content] = true if opts[:capture_binary_content]
|
24
26
|
end
|
25
27
|
|
26
28
|
def reset
|
data/spec/e2e/selenium_spec.rb
CHANGED
@@ -17,6 +17,20 @@ describe "Proxy + WebDriver" do
|
|
17
17
|
proxy.close
|
18
18
|
}
|
19
19
|
|
20
|
+
describe 'request interceptor' do
|
21
|
+
it "modifies request" do
|
22
|
+
proxy.new_har("1", :capture_headers => true)
|
23
|
+
proxy.request_interceptor = 'request.getMethod().setHeader("foo", "bar");'
|
24
|
+
|
25
|
+
driver.get url_for("1.html")
|
26
|
+
wait.until { driver.title == '1' }
|
27
|
+
|
28
|
+
entry = proxy.har.entries.first
|
29
|
+
header = entry.request.headers.find { |h| h['name'] == "foo" }
|
30
|
+
header['value'].should == "bar"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
20
34
|
it "should fetch a HAR" do
|
21
35
|
proxy.new_har("1")
|
22
36
|
driver.get url_for("1.html")
|
data/spec/unit/client_spec.rb
CHANGED
@@ -20,7 +20,9 @@ module BrowserMob
|
|
20
20
|
"auth/basic/#{DOMAIN}" => double("resource[auth/basic/#{DOMAIN}]"),
|
21
21
|
"hosts" => double("resource[hosts]"),
|
22
22
|
"timeout" => double("resource[timeout]"),
|
23
|
-
"rewrite" => double("resource[rewrite]")
|
23
|
+
"rewrite" => double("resource[rewrite]"),
|
24
|
+
"interceptor/request" => double("resource[interceptor/request]"),
|
25
|
+
"interceptor/response" => double("resource[interceptor/response]")
|
24
26
|
}.each do |path, mock|
|
25
27
|
resource.stub(:[]).with(path).and_return(mock)
|
26
28
|
end
|
@@ -128,6 +130,16 @@ module BrowserMob
|
|
128
130
|
client.clear_blacklist
|
129
131
|
end
|
130
132
|
|
133
|
+
it "creates request interceptor" do
|
134
|
+
resource['interceptor/request'].should_receive(:post).with("foo", :content_type => "text/plain")
|
135
|
+
client.request_interceptor = "foo"
|
136
|
+
end
|
137
|
+
|
138
|
+
it "creates response interceptor" do
|
139
|
+
resource['interceptor/response'].should_receive(:post).with("foo", :content_type => "text/plain")
|
140
|
+
client.response_interceptor = "foo"
|
141
|
+
end
|
142
|
+
|
131
143
|
describe 'whitelist' do
|
132
144
|
it "supports a string" do
|
133
145
|
resource['whitelist'].should_receive(:put).
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browsermob-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jari.bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.
|
75
|
+
version: '2.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.
|
82
|
+
version: '2.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: selenium-webdriver
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|