vcr 2.0.0.rc1 → 2.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/.gitignore +2 -0
  2. data/.limited_red +1 -0
  3. data/.travis.yml +10 -1
  4. data/.yardopts +9 -0
  5. data/CHANGELOG.md +51 -1
  6. data/Gemfile +5 -1
  7. data/LICENSE +1 -1
  8. data/README.md +23 -28
  9. data/Rakefile +63 -18
  10. data/Upgrade.md +200 -0
  11. data/features/.nav +2 -0
  12. data/features/cassettes/automatic_re_recording.feature +19 -15
  13. data/features/cassettes/dynamic_erb.feature +12 -4
  14. data/features/cassettes/exclusive.feature +31 -23
  15. data/features/cassettes/format.feature +54 -30
  16. data/features/cassettes/naming.feature +1 -1
  17. data/features/cassettes/update_content_length_header.feature +16 -12
  18. data/features/configuration/allow_http_connections_when_no_cassette.feature +1 -1
  19. data/features/configuration/debug_logging.feature +52 -0
  20. data/features/configuration/filter_sensitive_data.feature +4 -4
  21. data/features/configuration/hook_into.feature +5 -2
  22. data/features/configuration/ignore_request.feature +5 -3
  23. data/features/configuration/preserve_exact_body_bytes.feature +103 -0
  24. data/features/hooks/after_http_request.feature +17 -4
  25. data/features/hooks/around_http_request.feature +2 -1
  26. data/features/hooks/before_http_request.feature +25 -8
  27. data/features/hooks/before_playback.feature +16 -12
  28. data/features/hooks/before_record.feature +2 -2
  29. data/features/http_libraries/em_http_request.feature +82 -58
  30. data/features/http_libraries/net_http.feature +6 -6
  31. data/features/middleware/faraday.feature +2 -1
  32. data/features/middleware/rack.feature +2 -2
  33. data/features/record_modes/all.feature +19 -15
  34. data/features/record_modes/new_episodes.feature +17 -13
  35. data/features/record_modes/none.feature +15 -11
  36. data/features/record_modes/once.feature +16 -12
  37. data/features/request_matching/body.feature +28 -20
  38. data/features/request_matching/custom_matcher.feature +28 -20
  39. data/features/request_matching/headers.feature +34 -26
  40. data/features/request_matching/host.feature +28 -20
  41. data/features/request_matching/identical_request_sequence.feature +28 -20
  42. data/features/request_matching/method.feature +28 -20
  43. data/features/request_matching/path.feature +28 -20
  44. data/features/request_matching/playback_repeats.feature +28 -20
  45. data/features/request_matching/uri.feature +28 -20
  46. data/features/request_matching/uri_without_param.feature +28 -20
  47. data/features/support/env.rb +7 -6
  48. data/features/support/vcr_cucumber_helpers.rb +1 -0
  49. data/features/test_frameworks/cucumber.feature +8 -8
  50. data/features/test_frameworks/rspec_macro.feature +4 -4
  51. data/features/test_frameworks/rspec_metadata.feature +6 -6
  52. data/features/test_frameworks/shoulda.feature +1 -1
  53. data/features/test_frameworks/test_unit.feature +1 -1
  54. data/lib/vcr.rb +156 -5
  55. data/lib/vcr/cassette.rb +80 -30
  56. data/lib/vcr/cassette/http_interaction_list.rb +33 -4
  57. data/lib/vcr/cassette/migrator.rb +2 -3
  58. data/lib/vcr/cassette/reader.rb +1 -0
  59. data/lib/vcr/cassette/serializers.rb +22 -0
  60. data/lib/vcr/cassette/serializers/json.rb +27 -2
  61. data/lib/vcr/cassette/serializers/psych.rb +26 -2
  62. data/lib/vcr/cassette/serializers/syck.rb +28 -2
  63. data/lib/vcr/cassette/serializers/yaml.rb +28 -2
  64. data/lib/vcr/configuration.rb +348 -10
  65. data/lib/vcr/deprecations.rb +8 -0
  66. data/lib/vcr/errors.rb +40 -0
  67. data/lib/vcr/extensions/net_http_response.rb +12 -11
  68. data/lib/vcr/library_hooks.rb +1 -0
  69. data/lib/vcr/library_hooks/excon.rb +24 -3
  70. data/lib/vcr/library_hooks/fakeweb.rb +32 -16
  71. data/lib/vcr/library_hooks/faraday.rb +3 -0
  72. data/lib/vcr/library_hooks/typhoeus.rb +40 -37
  73. data/lib/vcr/library_hooks/webmock.rb +54 -34
  74. data/lib/vcr/middleware/faraday.rb +13 -0
  75. data/lib/vcr/middleware/rack.rb +35 -0
  76. data/lib/vcr/request_handler.rb +60 -8
  77. data/lib/vcr/request_ignorer.rb +1 -0
  78. data/lib/vcr/request_matcher_registry.rb +28 -0
  79. data/lib/vcr/structs.rb +245 -38
  80. data/lib/vcr/test_frameworks/cucumber.rb +10 -0
  81. data/lib/vcr/test_frameworks/rspec.rb +26 -1
  82. data/lib/vcr/util/hooks.rb +29 -27
  83. data/lib/vcr/util/internet_connection.rb +2 -0
  84. data/lib/vcr/util/logger.rb +25 -0
  85. data/lib/vcr/util/variable_args_block_caller.rb +1 -0
  86. data/lib/vcr/util/version_checker.rb +1 -0
  87. data/lib/vcr/version.rb +8 -1
  88. data/spec/capture_warnings.rb +3 -3
  89. data/spec/monkey_patches.rb +28 -13
  90. data/spec/spec_helper.rb +17 -0
  91. data/spec/support/http_library_adapters.rb +7 -4
  92. data/spec/support/shared_example_groups/hook_into_http_library.rb +96 -32
  93. data/spec/support/shared_example_groups/request_hooks.rb +9 -8
  94. data/spec/support/sinatra_app.rb +3 -1
  95. data/spec/support/vcr_localhost_server.rb +1 -0
  96. data/spec/vcr/cassette/http_interaction_list_spec.rb +119 -54
  97. data/spec/vcr/cassette/migrator_spec.rb +19 -6
  98. data/spec/vcr/cassette/serializers_spec.rb +51 -6
  99. data/spec/vcr/cassette_spec.rb +44 -19
  100. data/spec/vcr/configuration_spec.rb +91 -6
  101. data/spec/vcr/library_hooks/excon_spec.rb +54 -16
  102. data/spec/vcr/library_hooks/fakeweb_spec.rb +12 -21
  103. data/spec/vcr/library_hooks/typhoeus_spec.rb +2 -29
  104. data/spec/vcr/library_hooks/webmock_spec.rb +4 -18
  105. data/spec/vcr/middleware/faraday_spec.rb +1 -16
  106. data/spec/vcr/structs_spec.rb +194 -61
  107. data/spec/vcr/test_frameworks/rspec_spec.rb +10 -0
  108. data/spec/vcr/util/hooks_spec.rb +104 -56
  109. data/spec/vcr/util/version_checker_spec.rb +45 -0
  110. data/spec/vcr_spec.rb +11 -0
  111. data/vcr.gemspec +30 -34
  112. metadata +149 -95
  113. data/spec/support/shared_example_groups/version_checking.rb +0 -34
@@ -51,7 +51,7 @@ Feature: Filter sensitive data
51
51
  """
52
52
  When I run `ruby filtering.rb --with-server`
53
53
  Then the output should contain "Response: Hello World"
54
- And the file "cassettes/filtering.yml" should contain "body: <GREETING> <LOCATION>"
54
+ And the file "cassettes/filtering.yml" should contain "<GREETING> <LOCATION>"
55
55
  And the file "cassettes/filtering.yml" should not contain "Hello"
56
56
  And the file "cassettes/filtering.yml" should not contain "World"
57
57
 
@@ -90,8 +90,8 @@ Feature: Filter sensitive data
90
90
  Then the output should contain each of the following:
91
91
  | Tagged Response: Hello World 1 |
92
92
  | Untagged Response: Hello World 2 |
93
- And the file "cassettes/tagged.yml" should contain "body: Hello <LOCATION> 1"
94
- And the file "cassettes/untagged.yml" should contain "body: Hello World 2"
93
+ And the file "cassettes/tagged.yml" should contain "Hello <LOCATION> 1"
94
+ And the file "cassettes/untagged.yml" should contain "Hello World 2"
95
95
 
96
96
  When I run `ruby tagged_filtering.rb`
97
97
  Then the output should contain each of the following:
@@ -141,7 +141,7 @@ Feature: Filter sensitive data
141
141
  """
142
142
  When I run `ruby dynamic_filtering.rb --with-server`
143
143
  Then the output should contain "john.doe/monkey"
144
- And the file "cassettes/example.yml" should contain "body: john.doe/<PASSWORD>"
144
+ And the file "cassettes/example.yml" should contain "john.doe/<PASSWORD>"
145
145
  And the file "cassettes/example.yml" should contain a YAML fragment like:
146
146
  """
147
147
  X-Http-Password:
@@ -12,6 +12,7 @@ Feature: hook_into
12
12
  - Curb (Curl::Easy, but not Curl::Multi)
13
13
  - EM HTTP Request
14
14
  - Typhoeus (Typhoeus::Hydra, but not Typhoeus::Easy or Typhoeus::Multi)
15
+ - Excon
15
16
  - :typhoeus can be used to hook into itself (as long as you use Typhoeus::Hydra,
16
17
  but not Typhoeus::Easy or Typhoeus::Multi).
17
18
  - :excon can be used to hook into itself.
@@ -53,6 +54,7 @@ Feature: hook_into
53
54
  <configuration>
54
55
  c.cassette_library_dir = 'vcr_cassettes'
55
56
  c.ignore_localhost = false
57
+ c.default_cassette_options = { :serialize_with => :syck }
56
58
  end
57
59
 
58
60
  VCR.use_cassette('example') do
@@ -63,13 +65,13 @@ Feature: hook_into
63
65
  Then the output should contain each of the following:
64
66
  | The response for request 1 was: Hello World |
65
67
  | The response for request 2 was: Hello World |
66
- And the file "vcr_cassettes/example.yml" should contain "body: Hello World"
68
+ And the file "vcr_cassettes/example.yml" should contain "Hello World"
67
69
 
68
70
  When I run `ruby hook_into_http_lib_combo.rb 'Goodbye World'`
69
71
  Then the output should contain each of the following:
70
72
  | The response for request 1 was: Goodbye World |
71
73
  | The response for request 2 was: Hello World |
72
- And the file "vcr_cassettes/example.yml" should contain "body: Hello World"
74
+ And the file "vcr_cassettes/example.yml" should contain "Hello World"
73
75
 
74
76
  Examples:
75
77
  | configuration | http_lib |
@@ -80,6 +82,7 @@ Feature: hook_into
80
82
  | c.hook_into :webmock | patron |
81
83
  | c.hook_into :webmock | em-http-request |
82
84
  | c.hook_into :webmock | typhoeus |
85
+ | c.hook_into :webmock | excon |
83
86
  | c.hook_into :typhoeus | typhoeus |
84
87
  | c.hook_into :excon | excon |
85
88
  | c.hook_into :faraday | faraday (w/ net_http) |
@@ -48,6 +48,7 @@ Feature: Ignore Request
48
48
  URI(request.uri).port == 7777
49
49
  end
50
50
 
51
+ c.default_cassette_options = { :serialize_with => :syck }
51
52
  c.cassette_library_dir = 'cassettes'
52
53
  <configuration>
53
54
  end
@@ -75,8 +76,8 @@ Feature: Ignore Request
75
76
  Port 7777 Response 1
76
77
  Port 7777 Response 2
77
78
  """
78
- And the file "cassettes/example.yml" should contain "body: Port 8888"
79
- And the file "cassettes/example.yml" should not contain "body: Port 7777"
79
+ And the file "cassettes/example.yml" should contain "Port 8888"
80
+ And the file "cassettes/example.yml" should not contain "Port 7777"
80
81
 
81
82
  Examples:
82
83
  | configuration | http_lib |
@@ -132,6 +133,7 @@ Feature: Ignore Request
132
133
 
133
134
  VCR.configure do |c|
134
135
  c.cassette_library_dir = 'cassettes'
136
+ c.default_cassette_options = { :serialize_with => :syck }
135
137
  <configuration>
136
138
  end
137
139
 
@@ -143,7 +145,7 @@ Feature: Ignore Request
143
145
  """
144
146
  When I run `ruby localhost_not_ignored.rb`
145
147
  Then it should fail with "An HTTP request has been made that VCR does not know how to handle"
146
- And the file "cassettes/localhost.yml" should contain "body: Port 7777 Response 1"
148
+ And the file "cassettes/localhost.yml" should contain "Port 7777 Response 1"
147
149
 
148
150
  Examples:
149
151
  | configuration | http_lib |
@@ -0,0 +1,103 @@
1
+ @exclude-18
2
+ Feature: Preserve Exact Body Bytes
3
+
4
+ Some HTTP servers are not well-behaved and respond with invalid data: the response body may
5
+ not be encoded according to the encoding specified in the HTTP headers, or there may be bytes
6
+ that are invalid for the given encoding. The YAML and JSON serializers are not generally
7
+ designed to handle these cases gracefully, and you may get errors when the cassette is serialized
8
+ or deserialized. Also, the encoding may not be preserved when round-tripped through the
9
+ serializer.
10
+
11
+ VCR provides a configuration option to deal with cases like these. The `preserve_exact_body_bytes`
12
+ method accepts a block that VCR will use to determine if the body of the given request or response object
13
+ should be base64 encoded in order to preserve the bytes exactly as-is. VCR does not do this by
14
+ default, since base64-encoding the string removes the human readibility of the cassette.
15
+
16
+ Alternately, if you want to force an entire cassette to preserve the exact body bytes,
17
+ you can pass the `:preserve_exact_body_bytes => true` cassette option when inserting your
18
+ cassette.
19
+
20
+ Scenario: Preserve exact bytes for response body with invalid encoding
21
+ Given a file named "preserve.rb" with:
22
+ """ruby
23
+ # encoding: utf-8
24
+ string = "abc \xFA"
25
+ puts "Valid encoding: #{string.valid_encoding?}"
26
+
27
+ start_sinatra_app(:port => 7777) do
28
+ get('/') { string }
29
+ end
30
+
31
+ require 'vcr'
32
+
33
+ VCR.configure do |c|
34
+ c.cassette_library_dir = 'cassettes'
35
+ c.hook_into :fakeweb
36
+ c.preserve_exact_body_bytes do |http_message|
37
+ http_message.body.encoding.name == 'ASCII-8BIT' ||
38
+ !http_message.body.valid_encoding?
39
+ end
40
+ end
41
+
42
+ def make_request(label)
43
+ puts
44
+ puts label
45
+ VCR.use_cassette('example', :serialize_with => :json) do
46
+ body = Net::HTTP.get_response(URI("http://localhost:7777/")).body
47
+ puts "Body: #{body.inspect}"
48
+ end
49
+ end
50
+
51
+ make_request("Recording:")
52
+ make_request("Playback:")
53
+ """
54
+ When I run `ruby preserve.rb`
55
+ Then the output should contain exactly:
56
+ """
57
+ Valid encoding: false
58
+
59
+ Recording:
60
+ Body: "abc \xFA"
61
+
62
+ Playback:
63
+ Body: "abc \xFA"
64
+
65
+ """
66
+ And the file "cassettes/example.json" should contain:
67
+ """
68
+ "body":{"encoding":"ASCII-8BIT","base64_string":"YWJjIPo=\n"}
69
+ """
70
+
71
+ Scenario: Preserve exact bytes for cassette with `:preserve_exact_body_bytes` option
72
+ Given a file named "preserve.rb" with:
73
+ """ruby
74
+ start_sinatra_app(:port => 7777) do
75
+ get('/') { "Hello World" }
76
+ end
77
+
78
+ require 'vcr'
79
+
80
+ VCR.configure do |c|
81
+ c.cassette_library_dir = 'cassettes'
82
+ c.hook_into :fakeweb
83
+ c.default_cassette_options = { :serialize_with => :json }
84
+ end
85
+
86
+ VCR.use_cassette('preserve_bytes', :preserve_exact_body_bytes => true) do
87
+ Net::HTTP.get_response(URI("http://localhost:7777/"))
88
+ end
89
+
90
+ VCR.use_cassette('dont_preserve_bytes') do
91
+ Net::HTTP.get_response(URI("http://localhost:7777/"))
92
+ end
93
+ """
94
+ When I run `ruby preserve.rb`
95
+ Then the file "cassettes/preserve_bytes.json" should contain:
96
+ """
97
+ "body":{"encoding":"US-ASCII","base64_string":"SGVsbG8gV29ybGQ=\n"}
98
+ """
99
+ And the file "cassettes/dont_preserve_bytes.json" should contain:
100
+ """
101
+ "body":{"encoding":"US-ASCII","string":"Hello World"}
102
+ """
103
+
@@ -7,13 +7,24 @@ Feature: after_http_request hook
7
7
  * ejecting the current cassette (i.e. if you inserted it in a
8
8
  `before_http_request` hook)
9
9
 
10
+ You can also pass one or more "filters" to `after_http_request`, to make
11
+ the hook only be called for some requests. Any object that responds to `#to_proc`
12
+ can be a filter. Here are some simple examples:
13
+
14
+ * `:real?` -- only real requests
15
+ * `:stubbed?` -- only stubbed requests
16
+ * `:ignored?` -- only ignored requests
17
+ * `:recordable?` -- only requests that are being recorded
18
+ * `lambda { |req| URI(req.uri).host == 'amazon.com' }` -- only requests to amazon.com.
19
+
10
20
  Scenario Outline: log all requests and responses using after_http_request hook
11
21
  Given a file named "after_http_request.rb" with:
12
22
  """ruby
13
23
  include_http_adapter_for("<http_lib>")
14
24
 
15
25
  start_sinatra_app(:port => 7777) do
16
- get('/') { "Hello World" }
26
+ get('/foo') { "Hello World (foo)" }
27
+ get('/bar') { "Hello World (bar)" }
17
28
  end
18
29
 
19
30
  require 'vcr'
@@ -22,15 +33,17 @@ Feature: after_http_request hook
22
33
  <configuration>
23
34
  c.cassette_library_dir = 'cassettes'
24
35
  c.ignore_localhost = true
25
- c.after_http_request do |request, response|
36
+ c.after_http_request(lambda { |req| req.uri =~ /foo/ }) do |request, response|
26
37
  puts "Response for #{request.method} #{request.uri}: #{response.body}"
27
38
  end
28
39
  end
29
40
 
30
- make_http_request(:get, "http://localhost:7777/")
41
+ make_http_request(:get, "http://localhost:7777/foo")
42
+ make_http_request(:get, "http://localhost:7777/bar")
31
43
  """
32
44
  When I run `ruby after_http_request.rb`
33
- Then it should pass with "Response for get http://localhost:7777/: Hello World"
45
+ Then the output should contain "Response for get http://localhost:7777/foo: Hello World (foo)"
46
+ But the output should not contain "bar"
34
47
 
35
48
  Examples:
36
49
  | configuration | http_lib |
@@ -28,6 +28,7 @@ Feature: around_http_request hook
28
28
  VCR.configure do |c|
29
29
  <configuration>
30
30
  c.cassette_library_dir = 'cassettes'
31
+ c.default_cassette_options = { :serialize_with => :syck }
31
32
  c.around_http_request do |request|
32
33
  VCR.use_cassette('global', :record => :new_episodes, &request)
33
34
  end
@@ -42,7 +43,7 @@ Feature: around_http_request hook
42
43
  Response for request 1: Response 1
43
44
  Response for request 2: Response 1
44
45
  """
45
- And the file "cassettes/global.yml" should contain "body: Response 1"
46
+ And the file "cassettes/global.yml" should contain "Response 1"
46
47
 
47
48
  Examples:
48
49
  | configuration | http_lib |
@@ -7,13 +7,25 @@ Feature: before_http_request hook
7
7
  * inserting a particular cassette based on the request URI host
8
8
  * raising a timeout error
9
9
 
10
+ You can also pass one or more "filters" to `before_http_request`, to make
11
+ the hook only be called for some requests. Any object that responds to `#to_proc`
12
+ can be a filter. Here are some simple examples:
13
+
14
+ * `:real?` -- only real requests
15
+ * `:stubbed?` -- only stubbed requests
16
+ * `:ignored?` -- only ignored requests
17
+ * `:recordable?` -- only requests that are being recorded
18
+ * `lambda { |r| URI(r.uri).host == 'amazon.com' }` -- only requests to amazon.com.
19
+
10
20
  Scenario Outline: log all requests using a before_http_request hook
11
21
  Given a file named "before_http_request.rb" with:
12
22
  """ruby
13
23
  include_http_adapter_for("<http_lib>")
14
24
 
15
- start_sinatra_app(:port => 7777) do
16
- get('/') { "Hello World" }
25
+ if ARGV.include?('--with-server')
26
+ start_sinatra_app(:port => 7777) do
27
+ get('/') { "Hello World" }
28
+ end
17
29
  end
18
30
 
19
31
  require 'vcr'
@@ -21,16 +33,21 @@ Feature: before_http_request hook
21
33
  VCR.configure do |c|
22
34
  <configuration>
23
35
  c.cassette_library_dir = 'cassettes'
24
- c.ignore_localhost = true
25
- c.before_http_request do |request|
26
- puts "before request: #{request.method} #{request.uri}"
36
+ c.before_http_request(:real?) do |request|
37
+ File.open(ARGV.first, 'w') do |f|
38
+ f.write("before real request: #{request.method} #{request.uri}")
39
+ end
27
40
  end
28
41
  end
29
42
 
30
- make_http_request(:get, "http://localhost:7777/")
43
+ VCR.use_cassette('hook_example') do
44
+ make_http_request(:get, "http://localhost:7777/")
45
+ end
31
46
  """
32
- When I run `ruby before_http_request.rb`
33
- Then it should pass with "before request: get http://localhost:7777/"
47
+ When I run `ruby before_http_request.rb run1.log --with-server`
48
+ Then the file "run1.log" should contain "before real request: get http://localhost:7777/"
49
+ When I run `ruby before_http_request.rb run2.log`
50
+ Then the file "run2.log" should not exist
34
51
 
35
52
  Examples:
36
53
  | configuration | http_lib |
@@ -26,24 +26,28 @@ Feature: before_playback hook
26
26
  Background:
27
27
  Given a previously recorded cassette file "cassettes/example.yml" with:
28
28
  """
29
- ---
30
- http_interactions:
31
- - request:
29
+ ---
30
+ http_interactions:
31
+ - request:
32
32
  method: get
33
33
  uri: http://localhost:7777/
34
- body: ''
34
+ body:
35
+ encoding: UTF-8
36
+ string: ""
35
37
  headers: {}
36
- response:
37
- status:
38
+ response:
39
+ status:
38
40
  code: 200
39
41
  message: OK
40
- headers:
41
- Content-Type:
42
+ headers:
43
+ Content-Type:
42
44
  - text/html;charset=utf-8
43
- Content-Length:
44
- - '20'
45
- body: previously recorded response
46
- http_version: '1.1'
45
+ Content-Length:
46
+ - "20"
47
+ body:
48
+ encoding: UTF-8
49
+ string: previously recorded response
50
+ http_version: "1.1"
47
51
  recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
48
52
  recorded_with: VCR 2.0.0
49
53
  """
@@ -46,7 +46,7 @@ Feature: before_record hook
46
46
  end
47
47
  """
48
48
  When I run `ruby before_record_example.rb`
49
- Then the file "cassettes/recording_example.yml" should contain "body: Hello World"
49
+ Then the file "cassettes/recording_example.yml" should contain "Hello World"
50
50
  And the file "cassettes/recording_example.yml" should not contain "Earth"
51
51
 
52
52
  Scenario: Modify recorded response based on the cassette
@@ -72,7 +72,7 @@ Feature: before_record hook
72
72
  end
73
73
  """
74
74
  When I run `ruby before_record_example.rb`
75
- Then the file "cassettes/recording_example.yml" should contain "body: Hello Earth (recording_example)"
75
+ Then the file "cassettes/recording_example.yml" should contain "Hello Earth (recording_example)"
76
76
 
77
77
  Scenario: Prevent recording by ignoring interaction in before_record hook
78
78
  Given a file named "before_record_ignore.rb" with:
@@ -59,57 +59,69 @@ Feature: EM HTTP Request
59
59
  """
60
60
  And the file "cassettes/em_http.yml" should contain YAML like:
61
61
  """
62
- ---
63
- http_interactions:
64
- - request:
62
+ ---
63
+ http_interactions:
64
+ - request:
65
65
  method: get
66
66
  uri: http://localhost:7777/foo
67
- body: ''
67
+ body:
68
+ encoding: UTF-8
69
+ string: ""
68
70
  headers: {}
69
- response:
70
- status:
71
+ response:
72
+ status:
71
73
  code: 200
72
74
  message: OK
73
- headers:
74
- Content-Type:
75
+ headers:
76
+ Content-Type:
75
77
  - text/html;charset=utf-8
76
- Content-Length:
77
- - '9'
78
- body: Hello foo
78
+ Content-Length:
79
+ - "9"
80
+ body:
81
+ encoding: UTF-8
82
+ string: Hello foo
79
83
  http_version:
80
84
  recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
81
- - request:
85
+ - request:
82
86
  method: get
83
87
  uri: http://localhost:7777/bar
84
- body: ''
88
+ body:
89
+ encoding: UTF-8
90
+ string: ""
85
91
  headers: {}
86
- response:
87
- status:
92
+ response:
93
+ status:
88
94
  code: 200
89
95
  message: OK
90
- headers:
91
- Content-Type:
96
+ headers:
97
+ Content-Type:
92
98
  - text/html;charset=utf-8
93
- Content-Length:
94
- - '9'
95
- body: Hello bar
99
+ Content-Length:
100
+ - "9"
101
+ body:
102
+ encoding: UTF-8
103
+ string: Hello bar
96
104
  http_version:
97
105
  recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
98
- - request:
106
+ - request:
99
107
  method: get
100
108
  uri: http://localhost:7777/bazz
101
- body: ''
109
+ body:
110
+ encoding: UTF-8
111
+ string: ""
102
112
  headers: {}
103
- response:
104
- status:
113
+ response:
114
+ status:
105
115
  code: 200
106
116
  message: OK
107
- headers:
108
- Content-Type:
117
+ headers:
118
+ Content-Type:
109
119
  - text/html;charset=utf-8
110
- Content-Length:
111
- - '10'
112
- body: Hello bazz
120
+ Content-Length:
121
+ - "10"
122
+ body:
123
+ encoding: UTF-8
124
+ string: Hello bazz
113
125
  http_version:
114
126
  recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
115
127
  recorded_with: VCR 2.0.0
@@ -154,57 +166,69 @@ Feature: EM HTTP Request
154
166
  """
155
167
  And the file "cassettes/em_http.yml" should contain YAML like:
156
168
  """
157
- ---
158
- http_interactions:
159
- - request:
169
+ ---
170
+ http_interactions:
171
+ - request:
160
172
  method: get
161
173
  uri: http://localhost:7777/foo
162
- body: ''
174
+ body:
175
+ encoding: UTF-8
176
+ string: ""
163
177
  headers: {}
164
- response:
165
- status:
178
+ response:
179
+ status:
166
180
  code: 200
167
181
  message: OK
168
- headers:
169
- Content-Type:
182
+ headers:
183
+ Content-Type:
170
184
  - text/html;charset=utf-8
171
- Content-Length:
172
- - '9'
173
- body: Hello foo
185
+ Content-Length:
186
+ - "9"
187
+ body:
188
+ encoding: UTF-8
189
+ string: Hello foo
174
190
  http_version:
175
191
  recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
176
- - request:
192
+ - request:
177
193
  method: get
178
194
  uri: http://localhost:7777/bar
179
- body: ''
195
+ body:
196
+ encoding: UTF-8
197
+ string: ""
180
198
  headers: {}
181
- response:
182
- status:
199
+ response:
200
+ status:
183
201
  code: 200
184
202
  message: OK
185
- headers:
186
- Content-Type:
203
+ headers:
204
+ Content-Type:
187
205
  - text/html;charset=utf-8
188
- Content-Length:
189
- - '9'
190
- body: Hello bar
206
+ Content-Length:
207
+ - "9"
208
+ body:
209
+ encoding: UTF-8
210
+ string: Hello bar
191
211
  http_version:
192
212
  recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
193
- - request:
213
+ - request:
194
214
  method: get
195
215
  uri: http://localhost:7777/bazz
196
- body: ''
216
+ body:
217
+ encoding: UTF-8
218
+ string: ""
197
219
  headers: {}
198
- response:
199
- status:
220
+ response:
221
+ status:
200
222
  code: 200
201
223
  message: OK
202
- headers:
203
- Content-Type:
224
+ headers:
225
+ Content-Type:
204
226
  - text/html;charset=utf-8
205
- Content-Length:
206
- - '10'
207
- body: Hello bazz
227
+ Content-Length:
228
+ - "10"
229
+ body:
230
+ encoding: UTF-8
231
+ string: Hello bazz
208
232
  http_version:
209
233
  recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
210
234
  recorded_with: VCR 2.0.0