rest-man 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/multi-matrix-test.yml +35 -0
- data/.github/workflows/single-matrix-test.yml +27 -0
- data/.gitignore +13 -0
- data/.mailmap +10 -0
- data/.rspec +2 -0
- data/.rubocop +2 -0
- data/.rubocop-disables.yml +386 -0
- data/.rubocop.yml +8 -0
- data/AUTHORS +106 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +11 -0
- data/LICENSE +21 -0
- data/README.md +843 -0
- data/Rakefile +140 -0
- data/exe/restman +92 -0
- data/lib/rest-man.rb +2 -0
- data/lib/rest_man.rb +2 -0
- data/lib/restman/abstract_response.rb +252 -0
- data/lib/restman/exceptions.rb +238 -0
- data/lib/restman/params_array.rb +72 -0
- data/lib/restman/payload.rb +234 -0
- data/lib/restman/platform.rb +49 -0
- data/lib/restman/raw_response.rb +49 -0
- data/lib/restman/request.rb +859 -0
- data/lib/restman/resource.rb +178 -0
- data/lib/restman/response.rb +90 -0
- data/lib/restman/utils.rb +274 -0
- data/lib/restman/version.rb +8 -0
- data/lib/restman/windows/root_certs.rb +105 -0
- data/lib/restman/windows.rb +8 -0
- data/lib/restman.rb +183 -0
- data/matrixeval.yml +73 -0
- data/rest-man.gemspec +41 -0
- data/spec/ISS.jpg +0 -0
- data/spec/cassettes/request_httpbin_with_basic_auth.yml +83 -0
- data/spec/cassettes/request_httpbin_with_cookies.yml +49 -0
- data/spec/cassettes/request_httpbin_with_cookies_2.yml +94 -0
- data/spec/cassettes/request_httpbin_with_cookies_3.yml +49 -0
- data/spec/cassettes/request_httpbin_with_encoding_deflate.yml +45 -0
- data/spec/cassettes/request_httpbin_with_encoding_deflate_and_accept_headers.yml +44 -0
- data/spec/cassettes/request_httpbin_with_encoding_gzip.yml +45 -0
- data/spec/cassettes/request_httpbin_with_encoding_gzip_and_accept_headers.yml +44 -0
- data/spec/cassettes/request_httpbin_with_user_agent.yml +44 -0
- data/spec/cassettes/request_mozilla_org.yml +151 -0
- data/spec/cassettes/request_mozilla_org_callback_returns_true.yml +178 -0
- data/spec/cassettes/request_mozilla_org_with_system_cert.yml +152 -0
- data/spec/cassettes/request_mozilla_org_with_system_cert_and_callback.yml +151 -0
- data/spec/helpers.rb +54 -0
- data/spec/integration/_lib.rb +1 -0
- data/spec/integration/capath_digicert/README +8 -0
- data/spec/integration/capath_digicert/ce5e74ef.0 +1 -0
- data/spec/integration/capath_digicert/digicert.crt +20 -0
- data/spec/integration/capath_digicert/update +1 -0
- data/spec/integration/capath_verisign/415660c1.0 +14 -0
- data/spec/integration/capath_verisign/7651b327.0 +14 -0
- data/spec/integration/capath_verisign/README +8 -0
- data/spec/integration/capath_verisign/verisign.crt +14 -0
- data/spec/integration/certs/digicert.crt +20 -0
- data/spec/integration/certs/verisign.crt +14 -0
- data/spec/integration/httpbin_spec.rb +137 -0
- data/spec/integration/integration_spec.rb +118 -0
- data/spec/integration/request_spec.rb +134 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/unit/_lib.rb +1 -0
- data/spec/unit/abstract_response_spec.rb +145 -0
- data/spec/unit/exceptions_spec.rb +108 -0
- data/spec/unit/params_array_spec.rb +36 -0
- data/spec/unit/payload_spec.rb +295 -0
- data/spec/unit/raw_response_spec.rb +22 -0
- data/spec/unit/request2_spec.rb +54 -0
- data/spec/unit/request_spec.rb +1205 -0
- data/spec/unit/resource_spec.rb +134 -0
- data/spec/unit/response_spec.rb +252 -0
- data/spec/unit/restclient_spec.rb +80 -0
- data/spec/unit/utils_spec.rb +147 -0
- data/spec/unit/windows/root_certs_spec.rb +22 -0
- metadata +336 -0
data/lib/restman.rb
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'openssl'
|
3
|
+
require 'stringio'
|
4
|
+
require 'uri'
|
5
|
+
|
6
|
+
require File.dirname(__FILE__) + '/restman/version'
|
7
|
+
require File.dirname(__FILE__) + '/restman/platform'
|
8
|
+
require File.dirname(__FILE__) + '/restman/exceptions'
|
9
|
+
require File.dirname(__FILE__) + '/restman/utils'
|
10
|
+
require File.dirname(__FILE__) + '/restman/request'
|
11
|
+
require File.dirname(__FILE__) + '/restman/abstract_response'
|
12
|
+
require File.dirname(__FILE__) + '/restman/response'
|
13
|
+
require File.dirname(__FILE__) + '/restman/raw_response'
|
14
|
+
require File.dirname(__FILE__) + '/restman/resource'
|
15
|
+
require File.dirname(__FILE__) + '/restman/params_array'
|
16
|
+
require File.dirname(__FILE__) + '/restman/payload'
|
17
|
+
require File.dirname(__FILE__) + '/restman/windows'
|
18
|
+
|
19
|
+
# This module's static methods are the entry point for using the REST client.
|
20
|
+
#
|
21
|
+
# # GET
|
22
|
+
# xml = RestMan.get 'http://example.com/resource'
|
23
|
+
# jpg = RestMan.get 'http://example.com/resource', :accept => 'image/jpg'
|
24
|
+
#
|
25
|
+
# # authentication and SSL
|
26
|
+
# RestMan.get 'https://user:password@example.com/private/resource'
|
27
|
+
#
|
28
|
+
# # POST or PUT with a hash sends parameters as a urlencoded form body
|
29
|
+
# RestMan.post 'http://example.com/resource', :param1 => 'one'
|
30
|
+
#
|
31
|
+
# # nest hash parameters
|
32
|
+
# RestMan.post 'http://example.com/resource', :nested => { :param1 => 'one' }
|
33
|
+
#
|
34
|
+
# # POST and PUT with raw payloads
|
35
|
+
# RestMan.post 'http://example.com/resource', 'the post body', :content_type => 'text/plain'
|
36
|
+
# RestMan.post 'http://example.com/resource.xml', xml_doc
|
37
|
+
# RestMan.put 'http://example.com/resource.pdf', File.read('my.pdf'), :content_type => 'application/pdf'
|
38
|
+
#
|
39
|
+
# # DELETE
|
40
|
+
# RestMan.delete 'http://example.com/resource'
|
41
|
+
#
|
42
|
+
# # retrieve the response http code and headers
|
43
|
+
# res = RestMan.get 'http://example.com/some.jpg'
|
44
|
+
# res.code # => 200
|
45
|
+
# res.headers[:content_type] # => 'image/jpg'
|
46
|
+
#
|
47
|
+
# # HEAD
|
48
|
+
# RestMan.head('http://example.com').headers
|
49
|
+
#
|
50
|
+
# To use with a proxy, just set RestMan.proxy to the proper http proxy:
|
51
|
+
#
|
52
|
+
# RestMan.proxy = "http://proxy.example.com/"
|
53
|
+
#
|
54
|
+
# Or inherit the proxy from the environment:
|
55
|
+
#
|
56
|
+
# RestMan.proxy = ENV['http_proxy']
|
57
|
+
#
|
58
|
+
# For live tests of RestMan, try using http://rest-test.heroku.com, which echoes back information about the rest call:
|
59
|
+
#
|
60
|
+
# >> RestMan.put 'http://rest-test.heroku.com/resource', :foo => 'baz'
|
61
|
+
# => "PUT http://rest-test.heroku.com/resource with a 7 byte payload, content type application/x-www-form-urlencoded {\"foo\"=>\"baz\"}"
|
62
|
+
#
|
63
|
+
module RestMan
|
64
|
+
|
65
|
+
def self.get(url, headers={}, &block)
|
66
|
+
Request.execute(:method => :get, :url => url, :headers => headers, &block)
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.post(url, payload, headers={}, &block)
|
70
|
+
Request.execute(:method => :post, :url => url, :payload => payload, :headers => headers, &block)
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.patch(url, payload, headers={}, &block)
|
74
|
+
Request.execute(:method => :patch, :url => url, :payload => payload, :headers => headers, &block)
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.put(url, payload, headers={}, &block)
|
78
|
+
Request.execute(:method => :put, :url => url, :payload => payload, :headers => headers, &block)
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.delete(url, headers={}, &block)
|
82
|
+
Request.execute(:method => :delete, :url => url, :headers => headers, &block)
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.head(url, headers={}, &block)
|
86
|
+
Request.execute(:method => :head, :url => url, :headers => headers, &block)
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.options(url, headers={}, &block)
|
90
|
+
Request.execute(:method => :options, :url => url, :headers => headers, &block)
|
91
|
+
end
|
92
|
+
|
93
|
+
# A global proxy URL to use for all requests. This can be overridden on a
|
94
|
+
# per-request basis by passing `:proxy` to RestMan::Request.
|
95
|
+
def self.proxy
|
96
|
+
@proxy ||= nil
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.proxy=(value)
|
100
|
+
@proxy = value
|
101
|
+
@proxy_set = true
|
102
|
+
end
|
103
|
+
|
104
|
+
# Return whether RestMan.proxy was set explicitly. We use this to
|
105
|
+
# differentiate between no value being set and a value explicitly set to nil.
|
106
|
+
#
|
107
|
+
# @return [Boolean]
|
108
|
+
#
|
109
|
+
def self.proxy_set?
|
110
|
+
@proxy_set ||= false
|
111
|
+
end
|
112
|
+
|
113
|
+
# Setup the log for RestMan calls.
|
114
|
+
# Value should be a logger but can can be stdout, stderr, or a filename.
|
115
|
+
# You can also configure logging by the environment variable RESTCLIENT_LOG.
|
116
|
+
def self.log= log
|
117
|
+
@@log = create_log log
|
118
|
+
end
|
119
|
+
|
120
|
+
# Create a log that respond to << like a logger
|
121
|
+
# param can be 'stdout', 'stderr', a string (then we will log to that file) or a logger (then we return it)
|
122
|
+
def self.create_log param
|
123
|
+
if param
|
124
|
+
if param.is_a? String
|
125
|
+
if param == 'stdout'
|
126
|
+
stdout_logger = Class.new do
|
127
|
+
def << obj
|
128
|
+
STDOUT.puts obj
|
129
|
+
end
|
130
|
+
end
|
131
|
+
stdout_logger.new
|
132
|
+
elsif param == 'stderr'
|
133
|
+
stderr_logger = Class.new do
|
134
|
+
def << obj
|
135
|
+
STDERR.puts obj
|
136
|
+
end
|
137
|
+
end
|
138
|
+
stderr_logger.new
|
139
|
+
else
|
140
|
+
file_logger = Class.new do
|
141
|
+
attr_writer :target_file
|
142
|
+
|
143
|
+
def << obj
|
144
|
+
File.open(@target_file, 'a') { |f| f.puts obj }
|
145
|
+
end
|
146
|
+
end
|
147
|
+
logger = file_logger.new
|
148
|
+
logger.target_file = param
|
149
|
+
logger
|
150
|
+
end
|
151
|
+
else
|
152
|
+
param
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
@@env_log = create_log ENV['RESTCLIENT_LOG']
|
158
|
+
|
159
|
+
@@log = nil
|
160
|
+
|
161
|
+
def self.log # :nodoc:
|
162
|
+
@@env_log || @@log
|
163
|
+
end
|
164
|
+
|
165
|
+
@@before_execution_procs = []
|
166
|
+
|
167
|
+
# Add a Proc to be called before each request in executed.
|
168
|
+
# The proc parameters will be the http request and the request params.
|
169
|
+
def self.add_before_execution_proc &proc
|
170
|
+
raise ArgumentError.new('block is required') unless proc
|
171
|
+
@@before_execution_procs << proc
|
172
|
+
end
|
173
|
+
|
174
|
+
# Reset the procs to be called before each request is executed.
|
175
|
+
def self.reset_before_execution_procs
|
176
|
+
@@before_execution_procs = []
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.before_execution_procs # :nodoc:
|
180
|
+
@@before_execution_procs
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
data/matrixeval.yml
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
version: 0.4
|
2
|
+
target: ruby
|
3
|
+
project_name: rest_man
|
4
|
+
parallel_workers: number_of_processors
|
5
|
+
commands:
|
6
|
+
- jruby
|
7
|
+
# - ps
|
8
|
+
# - top
|
9
|
+
# - an_additional_command
|
10
|
+
# mounts:
|
11
|
+
# - /a/path/need/to/mount:/a/path/mount/to
|
12
|
+
matrix:
|
13
|
+
ruby:
|
14
|
+
variants:
|
15
|
+
- key: 2.7
|
16
|
+
container:
|
17
|
+
image: ruby:2.7.6
|
18
|
+
- key: 3.0
|
19
|
+
default: true
|
20
|
+
container:
|
21
|
+
image: ruby:3.0.4
|
22
|
+
- key: 3.1
|
23
|
+
container:
|
24
|
+
image: ruby:3.1.0
|
25
|
+
- key: jruby-9.3
|
26
|
+
container:
|
27
|
+
image: hoppergee/jruby:9.3.7-dev
|
28
|
+
env:
|
29
|
+
PATH: "/opt/jruby/bin:/app/bin:/bundle/bin:$PATH"
|
30
|
+
JRUBY_OPTS: "--dev -X-C --debug"
|
31
|
+
JAVA_OPTS: "-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1"
|
32
|
+
# mounts:
|
33
|
+
# - /a/path/need/to/mount:/a/path/mount/to
|
34
|
+
|
35
|
+
# rails:
|
36
|
+
# variants:
|
37
|
+
# - key: 6.1
|
38
|
+
# default: true
|
39
|
+
# env:
|
40
|
+
# RAILS_VERSION: "~> 6.1.0"
|
41
|
+
# - key: 7.0
|
42
|
+
# env:
|
43
|
+
# RAILS_VERSION: "~> 7.0.0"
|
44
|
+
# another:
|
45
|
+
# variants:
|
46
|
+
# - key: key1
|
47
|
+
# default: true
|
48
|
+
# env:
|
49
|
+
# ENV_KEY: 1
|
50
|
+
# - key: key2
|
51
|
+
# env:
|
52
|
+
# ENV_KEY: 2
|
53
|
+
|
54
|
+
exclude:
|
55
|
+
# - ruby: 3.0
|
56
|
+
# rails: 4.2
|
57
|
+
# - ruby: jruby-9.3
|
58
|
+
# rails: 7.0
|
59
|
+
|
60
|
+
docker-compose-extend:
|
61
|
+
# services:
|
62
|
+
# postgres:
|
63
|
+
# image: postgres:12.8
|
64
|
+
# volumes:
|
65
|
+
# - postgres12:/var/lib/postgresql/data
|
66
|
+
# environment:
|
67
|
+
# POSTGRES_HOST_AUTH_METHOD: trust
|
68
|
+
|
69
|
+
# redis:
|
70
|
+
# image: redis:6.2-alpine
|
71
|
+
|
72
|
+
# volumes:
|
73
|
+
# postgres12:
|
data/rest-man.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path('../lib/restman/version', __FILE__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'rest-man'
|
7
|
+
s.version = RestMan::VERSION
|
8
|
+
s.authors = ['Hopper Gee']
|
9
|
+
s.description = 'A simple HTTP and REST client for Ruby, inspired by the Sinatra microframework style of specifying actions: get, put, post, delete.'
|
10
|
+
s.license = 'MIT'
|
11
|
+
s.email = 'hopper.gee@hey.com'
|
12
|
+
s.extra_rdoc_files = ['README.md', 'CHANGELOG.md']
|
13
|
+
s.files = `git ls-files -z`.split("\0")
|
14
|
+
s.test_files = `git ls-files -z spec/`.split("\0")
|
15
|
+
s.bindir = "exe"
|
16
|
+
s.executables = ['restman']
|
17
|
+
|
18
|
+
s.homepage = 'https://github.com/rest-man/rest-man'
|
19
|
+
s.summary = 'Simple HTTP and REST client for Ruby, inspired by microframework syntax for specifying actions.'
|
20
|
+
|
21
|
+
s.add_development_dependency('webmock', '~> 3.0')
|
22
|
+
s.add_development_dependency('rspec', '~> 3.0', '< 3.10')
|
23
|
+
s.add_development_dependency('pry', '~> 0')
|
24
|
+
s.add_development_dependency('pry-doc', '~> 0')
|
25
|
+
s.add_development_dependency('rdoc', '>= 2.4.2', '< 7.0')
|
26
|
+
s.add_development_dependency('rubocop', '~> 0.49')
|
27
|
+
|
28
|
+
s.add_dependency('http-accept', '>= 1.7.0', '< 3.0')
|
29
|
+
s.add_dependency('http-cookie', '>= 1.0.2', '< 2.0')
|
30
|
+
s.add_dependency('mime-types', '>= 1.16', '< 4.0')
|
31
|
+
s.add_dependency('netrc', '~> 0.8')
|
32
|
+
|
33
|
+
s.required_ruby_version = '>= 2.0.0'
|
34
|
+
|
35
|
+
case ENV['BUILD_PLATFORM'] || RUBY_PLATFORM
|
36
|
+
when /(mingw32|mswin32)/
|
37
|
+
# ffi is needed for RestMan::Windows::RootCerts
|
38
|
+
s.add_dependency('ffi', '~> 1.9')
|
39
|
+
s.platform = platform
|
40
|
+
end
|
41
|
+
end
|
data/spec/ISS.jpg
ADDED
Binary file
|
@@ -0,0 +1,83 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://httpbin.org/basic-auth/user/pass
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
User-Agent:
|
13
|
+
- rest-man/1.0.0 (darwin21 arm64) ruby/2.7.6p219
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Host:
|
17
|
+
- httpbin.org
|
18
|
+
Authorization:
|
19
|
+
- Basic dXNlcjpwYXNz
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Mon, 30 May 2022 12:36:21 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Content-Length:
|
30
|
+
- '47'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Server:
|
34
|
+
- gunicorn/19.9.0
|
35
|
+
Access-Control-Allow-Origin:
|
36
|
+
- "*"
|
37
|
+
Access-Control-Allow-Credentials:
|
38
|
+
- 'true'
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: "{\n \"authenticated\": true, \n \"user\": \"user\"\n}\n"
|
42
|
+
recorded_at: Mon, 30 May 2022 12:36:21 GMT
|
43
|
+
- request:
|
44
|
+
method: get
|
45
|
+
uri: https://httpbin.org/basic-auth/user/pass
|
46
|
+
body:
|
47
|
+
encoding: US-ASCII
|
48
|
+
string: ''
|
49
|
+
headers:
|
50
|
+
Accept:
|
51
|
+
- "*/*"
|
52
|
+
User-Agent:
|
53
|
+
- rest-man/1.0.0 (darwin21 arm64) ruby/2.7.6p219
|
54
|
+
Accept-Encoding:
|
55
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
56
|
+
Host:
|
57
|
+
- httpbin.org
|
58
|
+
Authorization:
|
59
|
+
- Basic dXNlcjpiYWRwYXNz
|
60
|
+
response:
|
61
|
+
status:
|
62
|
+
code: 401
|
63
|
+
message: UNAUTHORIZED
|
64
|
+
headers:
|
65
|
+
Date:
|
66
|
+
- Mon, 30 May 2022 12:36:22 GMT
|
67
|
+
Content-Length:
|
68
|
+
- '0'
|
69
|
+
Connection:
|
70
|
+
- keep-alive
|
71
|
+
Server:
|
72
|
+
- gunicorn/19.9.0
|
73
|
+
Www-Authenticate:
|
74
|
+
- Basic realm="Fake Realm"
|
75
|
+
Access-Control-Allow-Origin:
|
76
|
+
- "*"
|
77
|
+
Access-Control-Allow-Credentials:
|
78
|
+
- 'true'
|
79
|
+
body:
|
80
|
+
encoding: UTF-8
|
81
|
+
string: ''
|
82
|
+
recorded_at: Mon, 30 May 2022 12:36:22 GMT
|
83
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://httpbin.org/cookies/set?foo=bar
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
User-Agent:
|
13
|
+
- rest-man/1.0.0 (darwin21 arm64) ruby/2.7.6p219
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Host:
|
17
|
+
- httpbin.org
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 302
|
21
|
+
message: FOUND
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Mon, 30 May 2022 12:34:45 GMT
|
25
|
+
Content-Type:
|
26
|
+
- text/html; charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '223'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Server:
|
32
|
+
- gunicorn/19.9.0
|
33
|
+
Location:
|
34
|
+
- "/cookies"
|
35
|
+
Set-Cookie:
|
36
|
+
- foo=bar; Path=/
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Allow-Credentials:
|
40
|
+
- 'true'
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: |-
|
44
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
45
|
+
<title>Redirecting...</title>
|
46
|
+
<h1>Redirecting...</h1>
|
47
|
+
<p>You should be redirected automatically to target URL: <a href="/cookies">/cookies</a>. If not click the link.
|
48
|
+
recorded_at: Mon, 30 May 2022 12:34:45 GMT
|
49
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,94 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://httpbin.org/cookies/set?foo=bar
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
User-Agent:
|
13
|
+
- rest-man/1.0.0 (darwin21 arm64) ruby/2.7.6p219
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Host:
|
17
|
+
- httpbin.org
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 302
|
21
|
+
message: FOUND
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Mon, 30 May 2022 12:35:37 GMT
|
25
|
+
Content-Type:
|
26
|
+
- text/html; charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '223'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Server:
|
32
|
+
- gunicorn/19.9.0
|
33
|
+
Location:
|
34
|
+
- "/cookies"
|
35
|
+
Set-Cookie:
|
36
|
+
- foo=bar; Path=/
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Allow-Credentials:
|
40
|
+
- 'true'
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: |-
|
44
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
45
|
+
<title>Redirecting...</title>
|
46
|
+
<h1>Redirecting...</h1>
|
47
|
+
<p>You should be redirected automatically to target URL: <a href="/cookies">/cookies</a>. If not click the link.
|
48
|
+
recorded_at: Mon, 30 May 2022 12:35:37 GMT
|
49
|
+
- request:
|
50
|
+
method: get
|
51
|
+
uri: https://httpbin.org/cookies
|
52
|
+
body:
|
53
|
+
encoding: US-ASCII
|
54
|
+
string: ''
|
55
|
+
headers:
|
56
|
+
Accept:
|
57
|
+
- "*/*"
|
58
|
+
User-Agent:
|
59
|
+
- rest-man/1.0.0 (darwin21 arm64) ruby/2.7.6p219
|
60
|
+
Cookie:
|
61
|
+
- foo=bar
|
62
|
+
Accept-Encoding:
|
63
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
64
|
+
Host:
|
65
|
+
- httpbin.org
|
66
|
+
response:
|
67
|
+
status:
|
68
|
+
code: 200
|
69
|
+
message: OK
|
70
|
+
headers:
|
71
|
+
Date:
|
72
|
+
- Mon, 30 May 2022 12:35:38 GMT
|
73
|
+
Content-Type:
|
74
|
+
- application/json
|
75
|
+
Content-Length:
|
76
|
+
- '40'
|
77
|
+
Connection:
|
78
|
+
- keep-alive
|
79
|
+
Server:
|
80
|
+
- gunicorn/19.9.0
|
81
|
+
Access-Control-Allow-Origin:
|
82
|
+
- "*"
|
83
|
+
Access-Control-Allow-Credentials:
|
84
|
+
- 'true'
|
85
|
+
body:
|
86
|
+
encoding: UTF-8
|
87
|
+
string: |
|
88
|
+
{
|
89
|
+
"cookies": {
|
90
|
+
"foo": "bar"
|
91
|
+
}
|
92
|
+
}
|
93
|
+
recorded_at: Mon, 30 May 2022 12:35:38 GMT
|
94
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://httpbin.org/cookies/set?foo=%22bar:baz%22
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
User-Agent:
|
13
|
+
- rest-man/1.0.0 (darwin21 arm64) ruby/2.7.6p219
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Host:
|
17
|
+
- httpbin.org
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 302
|
21
|
+
message: FOUND
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Mon, 30 May 2022 12:39:05 GMT
|
25
|
+
Content-Type:
|
26
|
+
- text/html; charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '223'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Server:
|
32
|
+
- gunicorn/19.9.0
|
33
|
+
Location:
|
34
|
+
- "/cookies"
|
35
|
+
Set-Cookie:
|
36
|
+
- foo="\"bar:baz\""; Path=/
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Allow-Credentials:
|
40
|
+
- 'true'
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: |-
|
44
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
45
|
+
<title>Redirecting...</title>
|
46
|
+
<h1>Redirecting...</h1>
|
47
|
+
<p>You should be redirected automatically to target URL: <a href="/cookies">/cookies</a>. If not click the link.
|
48
|
+
recorded_at: Mon, 30 May 2022 12:39:05 GMT
|
49
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://httpbin.org/deflate
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
User-Agent:
|
13
|
+
- rest-man/1.0.0 (darwin21 arm64) ruby/2.7.6p219
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Host:
|
17
|
+
- httpbin.org
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Mon, 30 May 2022 12:32:00 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '254'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Server:
|
32
|
+
- gunicorn/19.9.0
|
33
|
+
Access-Control-Allow-Origin:
|
34
|
+
- "*"
|
35
|
+
Access-Control-Allow-Credentials:
|
36
|
+
- 'true'
|
37
|
+
body:
|
38
|
+
encoding: ASCII-8BIT
|
39
|
+
string: "{\n \"deflated\": true, \n \"headers\": {\n \"Accept\": \"*/*\",
|
40
|
+
\n \"Accept-Encoding\": \"gzip;q=1.0,deflate;q=0.6,identity;q=0.3\", \n
|
41
|
+
\ \"Host\": \"httpbin.org\", \n \"User-Agent\": \"rest-man/1.0.0 (darwin21
|
42
|
+
arm64) ruby/2.7.6p219\", \n \"X-Amzn-Trace-Id\": \"Root=1-6294b940-009eaf8d5d374cf75292eff2\"\n
|
43
|
+
\ }, \n \"method\": \"GET\", \n \"origin\": \"159.65.106.225\"\n}\n"
|
44
|
+
recorded_at: Mon, 30 May 2022 12:32:00 GMT
|
45
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://httpbin.org/deflate
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
User-Agent:
|
13
|
+
- rest-man/1.0.0 (darwin21 arm64) ruby/2.7.6p219
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip, deflate
|
16
|
+
Host:
|
17
|
+
- httpbin.org
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Mon, 30 May 2022 12:41:31 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '235'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Server:
|
32
|
+
- gunicorn/19.9.0
|
33
|
+
Content-Encoding:
|
34
|
+
- deflate
|
35
|
+
Access-Control-Allow-Origin:
|
36
|
+
- "*"
|
37
|
+
Access-Control-Allow-Credentials:
|
38
|
+
- 'true'
|
39
|
+
body:
|
40
|
+
encoding: ASCII-8BIT
|
41
|
+
string: !binary |-
|
42
|
+
eJw9j01rwyAcxu/5FOJpLdVGTQwZ9JBD2XYdHeyq8d9EaDQYy1hLv/tMOnJ8fs8LPPcMIWzgfFERDH5FMVxhh2bYgzIQpsTuSSbQtC2MMWm83W/xElopObrWG+u62e5udtyh/9E1+O6npdzHOGrrqA/d6n1NEEjTgVsSAaZI2otNcs8pozl6MSr8WMcZUmGQxQaFq/5NXkXlyFm97nyTZrg5cgqqBfIx/8Gf3scDI5LXhdaVJvJsZF5zw5koBQghqqLgnBmcFh7P5wPE3i/lt+PpuY19sJ11M2NlTWVJWS4p5yXOHtkfO+dVfg==
|
43
|
+
recorded_at: Mon, 30 May 2022 12:41:31 GMT
|
44
|
+
recorded_with: VCR 6.1.0
|