httparty 0.13.7 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.editorconfig +18 -0
- data/.github/workflows/ci.yml +26 -0
- data/.gitignore +3 -0
- data/.rubocop_todo.yml +1 -1
- data/{History → Changelog.md} +226 -59
- data/Gemfile +10 -3
- data/Guardfile +3 -2
- data/README.md +8 -7
- data/bin/httparty +3 -1
- data/docs/README.md +191 -0
- data/examples/README.md +34 -12
- data/examples/aaws.rb +7 -3
- data/examples/body_stream.rb +14 -0
- data/examples/crack.rb +1 -1
- data/examples/custom_parsers.rb +5 -1
- data/examples/delicious.rb +4 -4
- data/examples/headers_and_user_agents.rb +7 -3
- data/examples/idn.rb +10 -0
- data/examples/logging.rb +4 -4
- data/examples/microsoft_graph.rb +52 -0
- data/examples/multipart.rb +22 -0
- data/examples/peer_cert.rb +9 -0
- data/examples/stackexchange.rb +1 -1
- data/examples/stream_download.rb +26 -0
- data/examples/tripit_sign_in.rb +17 -6
- data/examples/twitter.rb +2 -2
- data/examples/whoismyrep.rb +1 -1
- data/httparty.gemspec +7 -5
- data/lib/httparty/connection_adapter.rb +86 -20
- data/lib/httparty/cookie_hash.rb +10 -8
- data/lib/httparty/decompressor.rb +102 -0
- data/lib/httparty/exceptions.rb +8 -2
- data/lib/httparty/hash_conversions.rb +30 -8
- data/lib/httparty/headers_processor.rb +32 -0
- data/lib/httparty/logger/apache_formatter.rb +31 -6
- data/lib/httparty/logger/curl_formatter.rb +68 -23
- data/lib/httparty/logger/logger.rb +5 -1
- data/lib/httparty/logger/logstash_formatter.rb +61 -0
- data/lib/httparty/module_inheritable_attributes.rb +6 -4
- data/lib/httparty/net_digest_auth.rb +23 -21
- data/lib/httparty/parser.rb +25 -14
- data/lib/httparty/request/body.rb +105 -0
- data/lib/httparty/request/multipart_boundary.rb +13 -0
- data/lib/httparty/request.rb +160 -106
- data/lib/httparty/response/headers.rb +23 -19
- data/lib/httparty/response.rb +92 -13
- data/lib/httparty/response_fragment.rb +21 -0
- data/lib/httparty/text_encoder.rb +72 -0
- data/lib/httparty/utils.rb +13 -0
- data/lib/httparty/version.rb +3 -1
- data/lib/httparty.rb +98 -35
- data/website/css/common.css +1 -1
- metadata +34 -114
- data/.simplecov +0 -1
- data/.travis.yml +0 -7
- data/features/basic_authentication.feature +0 -20
- data/features/command_line.feature +0 -95
- data/features/deals_with_http_error_codes.feature +0 -26
- data/features/digest_authentication.feature +0 -30
- data/features/handles_compressed_responses.feature +0 -27
- data/features/handles_multiple_formats.feature +0 -57
- data/features/steps/env.rb +0 -27
- data/features/steps/httparty_response_steps.rb +0 -52
- data/features/steps/httparty_steps.rb +0 -43
- data/features/steps/mongrel_helper.rb +0 -127
- data/features/steps/remote_service_steps.rb +0 -90
- data/features/supports_read_timeout_option.feature +0 -13
- data/features/supports_redirection.feature +0 -22
- data/features/supports_timeout_option.feature +0 -13
- data/spec/fixtures/delicious.xml +0 -23
- data/spec/fixtures/empty.xml +0 -0
- data/spec/fixtures/google.html +0 -3
- data/spec/fixtures/ssl/generate.sh +0 -29
- data/spec/fixtures/ssl/generated/1fe462c2.0 +0 -16
- data/spec/fixtures/ssl/generated/bogushost.crt +0 -13
- data/spec/fixtures/ssl/generated/ca.crt +0 -16
- data/spec/fixtures/ssl/generated/ca.key +0 -15
- data/spec/fixtures/ssl/generated/selfsigned.crt +0 -14
- data/spec/fixtures/ssl/generated/server.crt +0 -13
- data/spec/fixtures/ssl/generated/server.key +0 -15
- data/spec/fixtures/ssl/openssl-exts.cnf +0 -9
- data/spec/fixtures/twitter.csv +0 -2
- data/spec/fixtures/twitter.json +0 -1
- data/spec/fixtures/twitter.xml +0 -403
- data/spec/fixtures/undefined_method_add_node_for_nil.xml +0 -2
- data/spec/httparty/connection_adapter_spec.rb +0 -468
- data/spec/httparty/cookie_hash_spec.rb +0 -83
- data/spec/httparty/exception_spec.rb +0 -38
- data/spec/httparty/hash_conversions_spec.rb +0 -41
- data/spec/httparty/logger/apache_formatter_spec.rb +0 -41
- data/spec/httparty/logger/curl_formatter_spec.rb +0 -18
- data/spec/httparty/logger/logger_spec.rb +0 -38
- data/spec/httparty/net_digest_auth_spec.rb +0 -230
- data/spec/httparty/parser_spec.rb +0 -173
- data/spec/httparty/request_spec.rb +0 -1073
- data/spec/httparty/response_spec.rb +0 -241
- data/spec/httparty/ssl_spec.rb +0 -74
- data/spec/httparty_spec.rb +0 -850
- data/spec/spec_helper.rb +0 -59
- data/spec/support/ssl_test_helper.rb +0 -47
- data/spec/support/ssl_test_server.rb +0 -80
- data/spec/support/stub_response.rb +0 -49
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HTTParty
|
4
|
+
class TextEncoder
|
5
|
+
attr_reader :text, :content_type, :assume_utf16_is_big_endian
|
6
|
+
|
7
|
+
def initialize(text, assume_utf16_is_big_endian: true, content_type: nil)
|
8
|
+
@text = +text
|
9
|
+
@content_type = content_type
|
10
|
+
@assume_utf16_is_big_endian = assume_utf16_is_big_endian
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
if can_encode?
|
15
|
+
encoded_text
|
16
|
+
else
|
17
|
+
text
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def can_encode?
|
24
|
+
''.respond_to?(:encoding) && charset
|
25
|
+
end
|
26
|
+
|
27
|
+
def encoded_text
|
28
|
+
if 'utf-16'.casecmp(charset) == 0
|
29
|
+
encode_utf_16
|
30
|
+
else
|
31
|
+
encode_with_ruby_encoding
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def encode_utf_16
|
36
|
+
if text.bytesize >= 2
|
37
|
+
if text.getbyte(0) == 0xFF && text.getbyte(1) == 0xFE
|
38
|
+
return text.force_encoding('UTF-16LE')
|
39
|
+
elsif text.getbyte(0) == 0xFE && text.getbyte(1) == 0xFF
|
40
|
+
return text.force_encoding('UTF-16BE')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if assume_utf16_is_big_endian # option
|
45
|
+
text.force_encoding('UTF-16BE')
|
46
|
+
else
|
47
|
+
text.force_encoding('UTF-16LE')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def encode_with_ruby_encoding
|
52
|
+
# NOTE: This will raise an argument error if the
|
53
|
+
# charset does not exist
|
54
|
+
encoding = Encoding.find(charset)
|
55
|
+
text.force_encoding(encoding.to_s)
|
56
|
+
rescue ArgumentError
|
57
|
+
text
|
58
|
+
end
|
59
|
+
|
60
|
+
def charset
|
61
|
+
return nil if content_type.nil?
|
62
|
+
|
63
|
+
if (matchdata = content_type.match(/;\s*charset\s*=\s*([^=,;"\s]+)/i))
|
64
|
+
return matchdata.captures.first
|
65
|
+
end
|
66
|
+
|
67
|
+
if (matchdata = content_type.match(/;\s*charset\s*=\s*"((\\.|[^\\"])+)"/i))
|
68
|
+
return matchdata.captures.first.gsub(/\\(.)/, '\1')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HTTParty
|
4
|
+
module Utils
|
5
|
+
def self.stringify_keys(hash)
|
6
|
+
return hash.transform_keys(&:to_s) if hash.respond_to?(:transform_keys)
|
7
|
+
|
8
|
+
hash.each_with_object({}) do |(key, value), new_hash|
|
9
|
+
new_hash[key.to_s] = value
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/httparty/version.rb
CHANGED
data/lib/httparty.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pathname'
|
2
4
|
require 'net/http'
|
3
|
-
require 'net/https'
|
4
5
|
require 'uri'
|
5
6
|
require 'zlib'
|
6
7
|
require 'multi_xml'
|
8
|
+
require 'mini_mime'
|
7
9
|
require 'json'
|
8
10
|
require 'csv'
|
9
|
-
require 'erb'
|
10
11
|
|
11
12
|
require 'httparty/module_inheritable_attributes'
|
12
13
|
require 'httparty/cookie_hash'
|
@@ -14,6 +15,11 @@ require 'httparty/net_digest_auth'
|
|
14
15
|
require 'httparty/version'
|
15
16
|
require 'httparty/connection_adapter'
|
16
17
|
require 'httparty/logger/logger'
|
18
|
+
require 'httparty/request/body'
|
19
|
+
require 'httparty/response_fragment'
|
20
|
+
require 'httparty/decompressor'
|
21
|
+
require 'httparty/text_encoder'
|
22
|
+
require 'httparty/headers_processor'
|
17
23
|
|
18
24
|
# @see HTTParty::ClassMethods
|
19
25
|
module HTTParty
|
@@ -22,8 +28,8 @@ module HTTParty
|
|
22
28
|
base.send :include, ModuleInheritableAttributes
|
23
29
|
base.send(:mattr_inheritable, :default_options)
|
24
30
|
base.send(:mattr_inheritable, :default_cookies)
|
25
|
-
base.instance_variable_set(
|
26
|
-
base.instance_variable_set(
|
31
|
+
base.instance_variable_set(:@default_options, {})
|
32
|
+
base.instance_variable_set(:@default_cookies, CookieHash.new)
|
27
33
|
end
|
28
34
|
|
29
35
|
# == Common Request Options
|
@@ -37,10 +43,11 @@ module HTTParty
|
|
37
43
|
# [:+limit+:] Maximum number of redirects to follow. Takes precedences over :+no_follow+.
|
38
44
|
# [:+query+:] Query string, or an object that responds to #to_hash representing it. Normalized according to the same rules as :+body+. If you specify this on a POST, you must use an object which responds to #to_hash. See also HTTParty::ClassMethods.default_params.
|
39
45
|
# [:+timeout+:] Timeout for opening connection and reading data.
|
40
|
-
# [:+local_host
|
41
|
-
# [:+local_port
|
42
|
-
# [:+
|
43
|
-
# [:+stream_body
|
46
|
+
# [:+local_host+:] Local address to bind to before connecting.
|
47
|
+
# [:+local_port+:] Local port to bind to before connecting.
|
48
|
+
# [:+body_stream+:] Allow streaming to a REST server to specify a body_stream.
|
49
|
+
# [:+stream_body+:] Allow for streaming large files without loading them into memory.
|
50
|
+
# [:+multipart+:] Force content-type to be multipart
|
44
51
|
#
|
45
52
|
# There are also another set of options with names corresponding to various class methods. The methods in question are those that let you set a class-wide default, and the options override the defaults on a request-by-request basis. Those options are:
|
46
53
|
# * :+base_uri+: see HTTParty::ClassMethods.base_uri.
|
@@ -72,6 +79,16 @@ module HTTParty
|
|
72
79
|
default_options[:log_format] = format
|
73
80
|
end
|
74
81
|
|
82
|
+
# Raises HTTParty::ResponseError if response's code matches this statuses
|
83
|
+
#
|
84
|
+
# class Foo
|
85
|
+
# include HTTParty
|
86
|
+
# raise_on [404, 500]
|
87
|
+
# end
|
88
|
+
def raise_on(codes = [])
|
89
|
+
default_options[:raise_on] = *codes
|
90
|
+
end
|
91
|
+
|
75
92
|
# Allows setting http proxy information to be used
|
76
93
|
#
|
77
94
|
# class Foo
|
@@ -118,7 +135,7 @@ module HTTParty
|
|
118
135
|
end
|
119
136
|
|
120
137
|
# Do not send rails style query strings.
|
121
|
-
#
|
138
|
+
# Specifically, don't use bracket notation when sending an array
|
122
139
|
#
|
123
140
|
# For a query:
|
124
141
|
# get '/', query: {selected_ids: [1,2,3]}
|
@@ -147,7 +164,7 @@ module HTTParty
|
|
147
164
|
# default_params api_key: 'secret', another: 'foo'
|
148
165
|
# end
|
149
166
|
def default_params(h = {})
|
150
|
-
raise ArgumentError, 'Default params must an object which
|
167
|
+
raise ArgumentError, 'Default params must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
|
151
168
|
default_options[:default_params] ||= {}
|
152
169
|
default_options[:default_params].merge!(h)
|
153
170
|
end
|
@@ -159,9 +176,9 @@ module HTTParty
|
|
159
176
|
# include HTTParty
|
160
177
|
# default_timeout 10
|
161
178
|
# end
|
162
|
-
def default_timeout(
|
163
|
-
|
164
|
-
default_options[:timeout] =
|
179
|
+
def default_timeout(value)
|
180
|
+
validate_timeout_argument(__method__, value)
|
181
|
+
default_options[:timeout] = value
|
165
182
|
end
|
166
183
|
|
167
184
|
# Allows setting a default open_timeout for all HTTP calls in seconds
|
@@ -170,9 +187,9 @@ module HTTParty
|
|
170
187
|
# include HTTParty
|
171
188
|
# open_timeout 10
|
172
189
|
# end
|
173
|
-
def open_timeout(
|
174
|
-
|
175
|
-
default_options[:open_timeout] =
|
190
|
+
def open_timeout(value)
|
191
|
+
validate_timeout_argument(__method__, value)
|
192
|
+
default_options[:open_timeout] = value
|
176
193
|
end
|
177
194
|
|
178
195
|
# Allows setting a default read_timeout for all HTTP calls in seconds
|
@@ -181,11 +198,24 @@ module HTTParty
|
|
181
198
|
# include HTTParty
|
182
199
|
# read_timeout 10
|
183
200
|
# end
|
184
|
-
def read_timeout(
|
185
|
-
|
186
|
-
default_options[:read_timeout] =
|
201
|
+
def read_timeout(value)
|
202
|
+
validate_timeout_argument(__method__, value)
|
203
|
+
default_options[:read_timeout] = value
|
204
|
+
end
|
205
|
+
|
206
|
+
# Allows setting a default write_timeout for all HTTP calls in seconds
|
207
|
+
# Supported by Ruby > 2.6.0
|
208
|
+
#
|
209
|
+
# class Foo
|
210
|
+
# include HTTParty
|
211
|
+
# write_timeout 10
|
212
|
+
# end
|
213
|
+
def write_timeout(value)
|
214
|
+
validate_timeout_argument(__method__, value)
|
215
|
+
default_options[:write_timeout] = value
|
187
216
|
end
|
188
217
|
|
218
|
+
|
189
219
|
# Set an output stream for debugging, defaults to $stderr.
|
190
220
|
# The output stream is passed on to Net::HTTP#set_debug_output.
|
191
221
|
#
|
@@ -203,14 +233,18 @@ module HTTParty
|
|
203
233
|
# include HTTParty
|
204
234
|
# headers 'Accept' => 'text/html'
|
205
235
|
# end
|
206
|
-
def headers(h =
|
207
|
-
|
208
|
-
|
209
|
-
|
236
|
+
def headers(h = nil)
|
237
|
+
if h
|
238
|
+
raise ArgumentError, 'Headers must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
|
239
|
+
default_options[:headers] ||= {}
|
240
|
+
default_options[:headers].merge!(h.to_hash)
|
241
|
+
else
|
242
|
+
default_options[:headers] || {}
|
243
|
+
end
|
210
244
|
end
|
211
245
|
|
212
246
|
def cookies(h = {})
|
213
|
-
raise ArgumentError, 'Cookies must an object which
|
247
|
+
raise ArgumentError, 'Cookies must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
|
214
248
|
default_cookies.add_cookies(h)
|
215
249
|
end
|
216
250
|
|
@@ -367,6 +401,22 @@ module HTTParty
|
|
367
401
|
default_options[:ssl_version] = version
|
368
402
|
end
|
369
403
|
|
404
|
+
# Deactivate automatic decompression of the response body.
|
405
|
+
# This will require you to explicitly handle body decompression
|
406
|
+
# by inspecting the Content-Encoding response header.
|
407
|
+
#
|
408
|
+
# Refer to docs/README.md "HTTP Compression" section for
|
409
|
+
# further details.
|
410
|
+
#
|
411
|
+
# @example
|
412
|
+
# class Foo
|
413
|
+
# include HTTParty
|
414
|
+
# skip_decompression
|
415
|
+
# end
|
416
|
+
def skip_decompression(value = true)
|
417
|
+
default_options[:skip_decompression] = !!value
|
418
|
+
end
|
419
|
+
|
370
420
|
# Allows setting of SSL ciphers to use. This only works in Ruby 1.9+.
|
371
421
|
# You can get a list of valid specific ciphers from OpenSSL::Cipher.ciphers.
|
372
422
|
# You also can specify a cipher suite here, listed here at openssl.org:
|
@@ -486,7 +536,7 @@ module HTTParty
|
|
486
536
|
# Foo.post('http://foo.com/resources', body: {bar: 'baz'})
|
487
537
|
#
|
488
538
|
# # Simple post with full url using :query option,
|
489
|
-
# # which
|
539
|
+
# # which appends the parameters to the URI.
|
490
540
|
# Foo.post('http://foo.com/resources', query: {bar: 'baz'})
|
491
541
|
def post(path, options = {}, &block)
|
492
542
|
perform_request Net::HTTP::Post, path, options, &block
|
@@ -528,38 +578,50 @@ module HTTParty
|
|
528
578
|
perform_request Net::HTTP::Options, path, options, &block
|
529
579
|
end
|
530
580
|
|
581
|
+
# Perform a MKCOL request to a path
|
582
|
+
def mkcol(path, options = {}, &block)
|
583
|
+
perform_request Net::HTTP::Mkcol, path, options, &block
|
584
|
+
end
|
585
|
+
|
586
|
+
def lock(path, options = {}, &block)
|
587
|
+
perform_request Net::HTTP::Lock, path, options, &block
|
588
|
+
end
|
589
|
+
|
590
|
+
def unlock(path, options = {}, &block)
|
591
|
+
perform_request Net::HTTP::Unlock, path, options, &block
|
592
|
+
end
|
593
|
+
|
531
594
|
attr_reader :default_options
|
532
595
|
|
533
596
|
private
|
534
597
|
|
598
|
+
def validate_timeout_argument(timeout_type, value)
|
599
|
+
raise ArgumentError, "#{ timeout_type } must be an integer or float" unless value && (value.is_a?(Integer) || value.is_a?(Float))
|
600
|
+
end
|
601
|
+
|
535
602
|
def ensure_method_maintained_across_redirects(options)
|
536
|
-
unless options.
|
603
|
+
unless options.key?(:maintain_method_across_redirects)
|
537
604
|
options[:maintain_method_across_redirects] = true
|
538
605
|
end
|
539
606
|
end
|
540
607
|
|
541
608
|
def perform_request(http_method, path, options, &block) #:nodoc:
|
542
609
|
options = ModuleInheritableAttributes.hash_deep_dup(default_options).merge(options)
|
543
|
-
|
610
|
+
HeadersProcessor.new(headers, options).call
|
544
611
|
process_cookies(options)
|
545
612
|
Request.new(http_method, path, options).perform(&block)
|
546
613
|
end
|
547
614
|
|
548
|
-
def process_headers(options)
|
549
|
-
if options[:headers] && headers.any?
|
550
|
-
options[:headers] = headers.merge(options[:headers])
|
551
|
-
end
|
552
|
-
end
|
553
|
-
|
554
615
|
def process_cookies(options) #:nodoc:
|
555
616
|
return unless options[:cookies] || default_cookies.any?
|
556
617
|
options[:headers] ||= headers.dup
|
557
|
-
options[:headers][
|
618
|
+
options[:headers]['cookie'] = cookies.merge(options.delete(:cookies) || {}).to_cookie_string
|
558
619
|
end
|
559
620
|
|
560
621
|
def validate_format
|
561
622
|
if format && parser.respond_to?(:supports_format?) && !parser.supports_format?(format)
|
562
|
-
|
623
|
+
supported_format_names = parser.supported_formats.map(&:to_s).sort.join(', ')
|
624
|
+
raise UnsupportedFormat, "'#{format.inspect}' Must be one of: #{supported_format_names}"
|
563
625
|
end
|
564
626
|
end
|
565
627
|
end
|
@@ -617,6 +679,7 @@ module HTTParty
|
|
617
679
|
end
|
618
680
|
|
619
681
|
require 'httparty/hash_conversions'
|
682
|
+
require 'httparty/utils'
|
620
683
|
require 'httparty/exceptions'
|
621
684
|
require 'httparty/parser'
|
622
685
|
require 'httparty/request'
|
data/website/css/common.css
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}
|
9
9
|
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}/*ol,ul {list-style:none;}*/caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}
|
10
10
|
/* end of yahoo reset and fonts */
|
11
|
-
|
11
|
+
|
12
12
|
body {color:#333; background:#4b1a1a; line-height:1.3;}
|
13
13
|
p {margin:0 0 20px;}
|
14
14
|
a {color:#4b1a1a;}
|
metadata
CHANGED
@@ -1,44 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
- Sandro Turriate
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-12-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: multi_xml
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 0.5.2
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 0.5.2
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: mini_mime
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
34
|
+
version: 1.0.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.
|
41
|
+
version: 1.0.0
|
42
42
|
description: Makes http fun! Also, makes consuming restful web services dead easy.
|
43
43
|
email:
|
44
44
|
- nunemaker@gmail.com
|
@@ -47,103 +47,71 @@ executables:
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
+
- ".editorconfig"
|
51
|
+
- ".github/workflows/ci.yml"
|
50
52
|
- ".gitignore"
|
51
53
|
- ".rubocop.yml"
|
52
54
|
- ".rubocop_todo.yml"
|
53
|
-
- ".simplecov"
|
54
|
-
- ".travis.yml"
|
55
55
|
- CONTRIBUTING.md
|
56
|
+
- Changelog.md
|
56
57
|
- Gemfile
|
57
58
|
- Guardfile
|
58
|
-
- History
|
59
59
|
- MIT-LICENSE
|
60
60
|
- README.md
|
61
61
|
- Rakefile
|
62
62
|
- bin/httparty
|
63
63
|
- cucumber.yml
|
64
|
+
- docs/README.md
|
64
65
|
- examples/README.md
|
65
66
|
- examples/aaws.rb
|
66
67
|
- examples/basic.rb
|
68
|
+
- examples/body_stream.rb
|
67
69
|
- examples/crack.rb
|
68
70
|
- examples/custom_parsers.rb
|
69
71
|
- examples/delicious.rb
|
70
72
|
- examples/google.rb
|
71
73
|
- examples/headers_and_user_agents.rb
|
74
|
+
- examples/idn.rb
|
72
75
|
- examples/logging.rb
|
76
|
+
- examples/microsoft_graph.rb
|
77
|
+
- examples/multipart.rb
|
73
78
|
- examples/nokogiri_html_parser.rb
|
79
|
+
- examples/peer_cert.rb
|
74
80
|
- examples/rescue_json.rb
|
75
81
|
- examples/rubyurl.rb
|
76
82
|
- examples/stackexchange.rb
|
83
|
+
- examples/stream_download.rb
|
77
84
|
- examples/tripit_sign_in.rb
|
78
85
|
- examples/twitter.rb
|
79
86
|
- examples/whoismyrep.rb
|
80
|
-
- features/basic_authentication.feature
|
81
|
-
- features/command_line.feature
|
82
|
-
- features/deals_with_http_error_codes.feature
|
83
|
-
- features/digest_authentication.feature
|
84
|
-
- features/handles_compressed_responses.feature
|
85
|
-
- features/handles_multiple_formats.feature
|
86
|
-
- features/steps/env.rb
|
87
|
-
- features/steps/httparty_response_steps.rb
|
88
|
-
- features/steps/httparty_steps.rb
|
89
|
-
- features/steps/mongrel_helper.rb
|
90
|
-
- features/steps/remote_service_steps.rb
|
91
|
-
- features/supports_read_timeout_option.feature
|
92
|
-
- features/supports_redirection.feature
|
93
|
-
- features/supports_timeout_option.feature
|
94
87
|
- httparty.gemspec
|
95
88
|
- lib/httparty.rb
|
96
89
|
- lib/httparty/connection_adapter.rb
|
97
90
|
- lib/httparty/cookie_hash.rb
|
91
|
+
- lib/httparty/decompressor.rb
|
98
92
|
- lib/httparty/exceptions.rb
|
99
93
|
- lib/httparty/hash_conversions.rb
|
94
|
+
- lib/httparty/headers_processor.rb
|
100
95
|
- lib/httparty/logger/apache_formatter.rb
|
101
96
|
- lib/httparty/logger/curl_formatter.rb
|
102
97
|
- lib/httparty/logger/logger.rb
|
98
|
+
- lib/httparty/logger/logstash_formatter.rb
|
103
99
|
- lib/httparty/module_inheritable_attributes.rb
|
104
100
|
- lib/httparty/net_digest_auth.rb
|
105
101
|
- lib/httparty/parser.rb
|
106
102
|
- lib/httparty/request.rb
|
103
|
+
- lib/httparty/request/body.rb
|
104
|
+
- lib/httparty/request/multipart_boundary.rb
|
107
105
|
- lib/httparty/response.rb
|
108
106
|
- lib/httparty/response/headers.rb
|
107
|
+
- lib/httparty/response_fragment.rb
|
108
|
+
- lib/httparty/text_encoder.rb
|
109
|
+
- lib/httparty/utils.rb
|
109
110
|
- lib/httparty/version.rb
|
110
111
|
- script/release
|
111
|
-
- spec/fixtures/delicious.xml
|
112
|
-
- spec/fixtures/empty.xml
|
113
|
-
- spec/fixtures/google.html
|
114
|
-
- spec/fixtures/ssl/generate.sh
|
115
|
-
- spec/fixtures/ssl/generated/1fe462c2.0
|
116
|
-
- spec/fixtures/ssl/generated/bogushost.crt
|
117
|
-
- spec/fixtures/ssl/generated/ca.crt
|
118
|
-
- spec/fixtures/ssl/generated/ca.key
|
119
|
-
- spec/fixtures/ssl/generated/selfsigned.crt
|
120
|
-
- spec/fixtures/ssl/generated/server.crt
|
121
|
-
- spec/fixtures/ssl/generated/server.key
|
122
|
-
- spec/fixtures/ssl/openssl-exts.cnf
|
123
|
-
- spec/fixtures/twitter.csv
|
124
|
-
- spec/fixtures/twitter.json
|
125
|
-
- spec/fixtures/twitter.xml
|
126
|
-
- spec/fixtures/undefined_method_add_node_for_nil.xml
|
127
|
-
- spec/httparty/connection_adapter_spec.rb
|
128
|
-
- spec/httparty/cookie_hash_spec.rb
|
129
|
-
- spec/httparty/exception_spec.rb
|
130
|
-
- spec/httparty/hash_conversions_spec.rb
|
131
|
-
- spec/httparty/logger/apache_formatter_spec.rb
|
132
|
-
- spec/httparty/logger/curl_formatter_spec.rb
|
133
|
-
- spec/httparty/logger/logger_spec.rb
|
134
|
-
- spec/httparty/net_digest_auth_spec.rb
|
135
|
-
- spec/httparty/parser_spec.rb
|
136
|
-
- spec/httparty/request_spec.rb
|
137
|
-
- spec/httparty/response_spec.rb
|
138
|
-
- spec/httparty/ssl_spec.rb
|
139
|
-
- spec/httparty_spec.rb
|
140
|
-
- spec/spec_helper.rb
|
141
|
-
- spec/support/ssl_test_helper.rb
|
142
|
-
- spec/support/ssl_test_server.rb
|
143
|
-
- spec/support/stub_response.rb
|
144
112
|
- website/css/common.css
|
145
113
|
- website/index.html
|
146
|
-
homepage:
|
114
|
+
homepage: https://github.com/jnunemaker/httparty
|
147
115
|
licenses:
|
148
116
|
- MIT
|
149
117
|
metadata: {}
|
@@ -155,63 +123,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
123
|
requirements:
|
156
124
|
- - ">="
|
157
125
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
126
|
+
version: 2.3.0
|
159
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
128
|
requirements:
|
161
129
|
- - ">="
|
162
130
|
- !ruby/object:Gem::Version
|
163
131
|
version: '0'
|
164
132
|
requirements: []
|
165
|
-
|
166
|
-
|
167
|
-
signing_key:
|
133
|
+
rubygems_version: 3.3.7
|
134
|
+
signing_key:
|
168
135
|
specification_version: 4
|
169
136
|
summary: Makes http fun! Also, makes consuming restful web services dead easy.
|
170
|
-
test_files:
|
171
|
-
- features/basic_authentication.feature
|
172
|
-
- features/command_line.feature
|
173
|
-
- features/deals_with_http_error_codes.feature
|
174
|
-
- features/digest_authentication.feature
|
175
|
-
- features/handles_compressed_responses.feature
|
176
|
-
- features/handles_multiple_formats.feature
|
177
|
-
- features/steps/env.rb
|
178
|
-
- features/steps/httparty_response_steps.rb
|
179
|
-
- features/steps/httparty_steps.rb
|
180
|
-
- features/steps/mongrel_helper.rb
|
181
|
-
- features/steps/remote_service_steps.rb
|
182
|
-
- features/supports_read_timeout_option.feature
|
183
|
-
- features/supports_redirection.feature
|
184
|
-
- features/supports_timeout_option.feature
|
185
|
-
- spec/fixtures/delicious.xml
|
186
|
-
- spec/fixtures/empty.xml
|
187
|
-
- spec/fixtures/google.html
|
188
|
-
- spec/fixtures/ssl/generate.sh
|
189
|
-
- spec/fixtures/ssl/generated/1fe462c2.0
|
190
|
-
- spec/fixtures/ssl/generated/bogushost.crt
|
191
|
-
- spec/fixtures/ssl/generated/ca.crt
|
192
|
-
- spec/fixtures/ssl/generated/ca.key
|
193
|
-
- spec/fixtures/ssl/generated/selfsigned.crt
|
194
|
-
- spec/fixtures/ssl/generated/server.crt
|
195
|
-
- spec/fixtures/ssl/generated/server.key
|
196
|
-
- spec/fixtures/ssl/openssl-exts.cnf
|
197
|
-
- spec/fixtures/twitter.csv
|
198
|
-
- spec/fixtures/twitter.json
|
199
|
-
- spec/fixtures/twitter.xml
|
200
|
-
- spec/fixtures/undefined_method_add_node_for_nil.xml
|
201
|
-
- spec/httparty/connection_adapter_spec.rb
|
202
|
-
- spec/httparty/cookie_hash_spec.rb
|
203
|
-
- spec/httparty/exception_spec.rb
|
204
|
-
- spec/httparty/hash_conversions_spec.rb
|
205
|
-
- spec/httparty/logger/apache_formatter_spec.rb
|
206
|
-
- spec/httparty/logger/curl_formatter_spec.rb
|
207
|
-
- spec/httparty/logger/logger_spec.rb
|
208
|
-
- spec/httparty/net_digest_auth_spec.rb
|
209
|
-
- spec/httparty/parser_spec.rb
|
210
|
-
- spec/httparty/request_spec.rb
|
211
|
-
- spec/httparty/response_spec.rb
|
212
|
-
- spec/httparty/ssl_spec.rb
|
213
|
-
- spec/httparty_spec.rb
|
214
|
-
- spec/spec_helper.rb
|
215
|
-
- spec/support/ssl_test_helper.rb
|
216
|
-
- spec/support/ssl_test_server.rb
|
217
|
-
- spec/support/stub_response.rb
|
137
|
+
test_files: []
|
data/.simplecov
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
SimpleCov.start "test_frameworks"
|
data/.travis.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Feature: Basic Authentication
|
2
|
-
|
3
|
-
As a developer
|
4
|
-
I want to be able to use a service that requires Basic Authentication
|
5
|
-
Because that is not an uncommon requirement
|
6
|
-
|
7
|
-
Scenario: Passing no credentials to a page requiring Basic Authentication
|
8
|
-
Given a restricted page at '/basic_auth.html'
|
9
|
-
When I call HTTParty#get with '/basic_auth.html'
|
10
|
-
Then it should return a response with a 401 response code
|
11
|
-
|
12
|
-
Scenario: Passing proper credentials to a page requiring Basic Authentication
|
13
|
-
Given a remote service that returns 'Authenticated Page'
|
14
|
-
And that service is accessed at the path '/basic_auth.html'
|
15
|
-
And that service is protected by Basic Authentication
|
16
|
-
And that service requires the username 'jcash' with the password 'maninblack'
|
17
|
-
When I call HTTParty#get with '/basic_auth.html' and a basic_auth hash:
|
18
|
-
| username | password |
|
19
|
-
| jcash | maninblack |
|
20
|
-
Then the return value should match 'Authenticated Page'
|