httparty 0.16.2 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. checksums.yaml +5 -5
  2. data/.editorconfig +18 -0
  3. data/.github/dependabot.yml +6 -0
  4. data/.github/workflows/ci.yml +23 -0
  5. data/.gitignore +2 -0
  6. data/.rubocop_todo.yml +1 -1
  7. data/Changelog.md +425 -280
  8. data/Gemfile +7 -0
  9. data/Guardfile +3 -2
  10. data/README.md +5 -5
  11. data/docs/README.md +90 -5
  12. data/examples/README.md +28 -11
  13. data/examples/aaws.rb +6 -2
  14. data/examples/body_stream.rb +14 -0
  15. data/examples/idn.rb +10 -0
  16. data/examples/microsoft_graph.rb +52 -0
  17. data/examples/multipart.rb +22 -0
  18. data/examples/peer_cert.rb +9 -0
  19. data/examples/stream_download.rb +8 -2
  20. data/httparty.gemspec +4 -3
  21. data/lib/httparty/connection_adapter.rb +44 -20
  22. data/lib/httparty/cookie_hash.rb +10 -8
  23. data/lib/httparty/decompressor.rb +102 -0
  24. data/lib/httparty/exceptions.rb +3 -1
  25. data/lib/httparty/hash_conversions.rb +10 -4
  26. data/lib/httparty/headers_processor.rb +32 -0
  27. data/lib/httparty/logger/apache_formatter.rb +31 -6
  28. data/lib/httparty/logger/curl_formatter.rb +9 -7
  29. data/lib/httparty/logger/logger.rb +5 -1
  30. data/lib/httparty/logger/logstash_formatter.rb +62 -0
  31. data/lib/httparty/module_inheritable_attributes.rb +9 -9
  32. data/lib/httparty/net_digest_auth.rb +15 -15
  33. data/lib/httparty/parser.rb +12 -5
  34. data/lib/httparty/request/body.rb +54 -27
  35. data/lib/httparty/request/multipart_boundary.rb +2 -0
  36. data/lib/httparty/request.rb +105 -107
  37. data/lib/httparty/response/headers.rb +4 -2
  38. data/lib/httparty/response.rb +52 -9
  39. data/lib/httparty/response_fragment.rb +21 -0
  40. data/lib/httparty/text_encoder.rb +72 -0
  41. data/lib/httparty/utils.rb +13 -0
  42. data/lib/httparty/version.rb +3 -1
  43. data/lib/httparty.rb +81 -33
  44. data/script/release +4 -4
  45. data/website/css/common.css +1 -1
  46. metadata +50 -107
  47. data/.simplecov +0 -1
  48. data/.travis.yml +0 -10
  49. data/features/basic_authentication.feature +0 -20
  50. data/features/command_line.feature +0 -95
  51. data/features/deals_with_http_error_codes.feature +0 -26
  52. data/features/digest_authentication.feature +0 -30
  53. data/features/handles_compressed_responses.feature +0 -27
  54. data/features/handles_multiple_formats.feature +0 -57
  55. data/features/steps/env.rb +0 -27
  56. data/features/steps/httparty_response_steps.rb +0 -56
  57. data/features/steps/httparty_steps.rb +0 -43
  58. data/features/steps/mongrel_helper.rb +0 -127
  59. data/features/steps/remote_service_steps.rb +0 -92
  60. data/features/supports_read_timeout_option.feature +0 -13
  61. data/features/supports_redirection.feature +0 -22
  62. data/features/supports_timeout_option.feature +0 -13
  63. data/spec/fixtures/delicious.xml +0 -23
  64. data/spec/fixtures/empty.xml +0 -0
  65. data/spec/fixtures/google.html +0 -3
  66. data/spec/fixtures/ssl/generate.sh +0 -29
  67. data/spec/fixtures/ssl/generated/bogushost.crt +0 -13
  68. data/spec/fixtures/ssl/generated/ca.crt +0 -16
  69. data/spec/fixtures/ssl/generated/ca.key +0 -15
  70. data/spec/fixtures/ssl/generated/selfsigned.crt +0 -14
  71. data/spec/fixtures/ssl/generated/server.crt +0 -13
  72. data/spec/fixtures/ssl/generated/server.key +0 -15
  73. data/spec/fixtures/ssl/openssl-exts.cnf +0 -9
  74. data/spec/fixtures/tiny.gif +0 -0
  75. data/spec/fixtures/twitter.csv +0 -2
  76. data/spec/fixtures/twitter.json +0 -1
  77. data/spec/fixtures/twitter.xml +0 -403
  78. data/spec/fixtures/undefined_method_add_node_for_nil.xml +0 -2
  79. data/spec/httparty/connection_adapter_spec.rb +0 -498
  80. data/spec/httparty/cookie_hash_spec.rb +0 -100
  81. data/spec/httparty/exception_spec.rb +0 -45
  82. data/spec/httparty/hash_conversions_spec.rb +0 -56
  83. data/spec/httparty/logger/apache_formatter_spec.rb +0 -41
  84. data/spec/httparty/logger/curl_formatter_spec.rb +0 -119
  85. data/spec/httparty/logger/logger_spec.rb +0 -38
  86. data/spec/httparty/net_digest_auth_spec.rb +0 -270
  87. data/spec/httparty/parser_spec.rb +0 -190
  88. data/spec/httparty/request/body_spec.rb +0 -60
  89. data/spec/httparty/request_spec.rb +0 -1312
  90. data/spec/httparty/response_spec.rb +0 -347
  91. data/spec/httparty/ssl_spec.rb +0 -74
  92. data/spec/httparty_spec.rb +0 -896
  93. data/spec/spec_helper.rb +0 -51
  94. data/spec/support/ssl_test_helper.rb +0 -47
  95. data/spec/support/ssl_test_server.rb +0 -80
  96. data/spec/support/stub_response.rb +0 -49
data/lib/httparty.rb CHANGED
@@ -1,11 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
  require 'net/http'
3
- require 'net/https'
4
5
  require 'uri'
5
- require 'zlib'
6
- require 'multi_xml'
7
- require 'json'
8
- require 'csv'
9
6
 
10
7
  require 'httparty/module_inheritable_attributes'
11
8
  require 'httparty/cookie_hash'
@@ -13,6 +10,11 @@ require 'httparty/net_digest_auth'
13
10
  require 'httparty/version'
14
11
  require 'httparty/connection_adapter'
15
12
  require 'httparty/logger/logger'
13
+ require 'httparty/request/body'
14
+ require 'httparty/response_fragment'
15
+ require 'httparty/decompressor'
16
+ require 'httparty/text_encoder'
17
+ require 'httparty/headers_processor'
16
18
 
17
19
  # @see HTTParty::ClassMethods
18
20
  module HTTParty
@@ -21,8 +23,8 @@ module HTTParty
21
23
  base.send :include, ModuleInheritableAttributes
22
24
  base.send(:mattr_inheritable, :default_options)
23
25
  base.send(:mattr_inheritable, :default_cookies)
24
- base.instance_variable_set("@default_options", {})
25
- base.instance_variable_set("@default_cookies", CookieHash.new)
26
+ base.instance_variable_set(:@default_options, {})
27
+ base.instance_variable_set(:@default_cookies, CookieHash.new)
26
28
  end
27
29
 
28
30
  # == Common Request Options
@@ -36,10 +38,11 @@ module HTTParty
36
38
  # [:+limit+:] Maximum number of redirects to follow. Takes precedences over :+no_follow+.
37
39
  # [:+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.
38
40
  # [:+timeout+:] Timeout for opening connection and reading data.
39
- # [:+local_host:] Local address to bind to before connecting.
40
- # [:+local_port:] Local port to bind to before connecting.
41
- # [:+body_stream:] Allow streaming to a REST server to specify a body_stream.
42
- # [:+stream_body:] Allow for streaming large files without loading them into memory.
41
+ # [:+local_host+:] Local address to bind to before connecting.
42
+ # [:+local_port+:] Local port to bind to before connecting.
43
+ # [:+body_stream+:] Allow streaming to a REST server to specify a body_stream.
44
+ # [:+stream_body+:] Allow for streaming large files without loading them into memory.
45
+ # [:+multipart+:] Force content-type to be multipart
43
46
  #
44
47
  # 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:
45
48
  # * :+base_uri+: see HTTParty::ClassMethods.base_uri.
@@ -75,7 +78,7 @@ module HTTParty
75
78
  #
76
79
  # class Foo
77
80
  # include HTTParty
78
- # raise_on [404, 500]
81
+ # raise_on [404, 500, '5[0-9]*']
79
82
  # end
80
83
  def raise_on(codes = [])
81
84
  default_options[:raise_on] = *codes
@@ -168,9 +171,9 @@ module HTTParty
168
171
  # include HTTParty
169
172
  # default_timeout 10
170
173
  # end
171
- def default_timeout(t)
172
- raise ArgumentError, 'Timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
173
- default_options[:timeout] = t
174
+ def default_timeout(value)
175
+ validate_timeout_argument(__method__, value)
176
+ default_options[:timeout] = value
174
177
  end
175
178
 
176
179
  # Allows setting a default open_timeout for all HTTP calls in seconds
@@ -179,9 +182,9 @@ module HTTParty
179
182
  # include HTTParty
180
183
  # open_timeout 10
181
184
  # end
182
- def open_timeout(t)
183
- raise ArgumentError, 'open_timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
184
- default_options[:open_timeout] = t
185
+ def open_timeout(value)
186
+ validate_timeout_argument(__method__, value)
187
+ default_options[:open_timeout] = value
185
188
  end
186
189
 
187
190
  # Allows setting a default read_timeout for all HTTP calls in seconds
@@ -190,11 +193,24 @@ module HTTParty
190
193
  # include HTTParty
191
194
  # read_timeout 10
192
195
  # end
193
- def read_timeout(t)
194
- raise ArgumentError, 'read_timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
195
- default_options[:read_timeout] = t
196
+ def read_timeout(value)
197
+ validate_timeout_argument(__method__, value)
198
+ default_options[:read_timeout] = value
196
199
  end
197
200
 
201
+ # Allows setting a default write_timeout for all HTTP calls in seconds
202
+ # Supported by Ruby > 2.6.0
203
+ #
204
+ # class Foo
205
+ # include HTTParty
206
+ # write_timeout 10
207
+ # end
208
+ def write_timeout(value)
209
+ validate_timeout_argument(__method__, value)
210
+ default_options[:write_timeout] = value
211
+ end
212
+
213
+
198
214
  # Set an output stream for debugging, defaults to $stderr.
199
215
  # The output stream is passed on to Net::HTTP#set_debug_output.
200
216
  #
@@ -380,6 +396,22 @@ module HTTParty
380
396
  default_options[:ssl_version] = version
381
397
  end
382
398
 
399
+ # Deactivate automatic decompression of the response body.
400
+ # This will require you to explicitly handle body decompression
401
+ # by inspecting the Content-Encoding response header.
402
+ #
403
+ # Refer to docs/README.md "HTTP Compression" section for
404
+ # further details.
405
+ #
406
+ # @example
407
+ # class Foo
408
+ # include HTTParty
409
+ # skip_decompression
410
+ # end
411
+ def skip_decompression(value = true)
412
+ default_options[:skip_decompression] = !!value
413
+ end
414
+
383
415
  # Allows setting of SSL ciphers to use. This only works in Ruby 1.9+.
384
416
  # You can get a list of valid specific ciphers from OpenSSL::Cipher.ciphers.
385
417
  # You also can specify a cipher suite here, listed here at openssl.org:
@@ -546,10 +578,29 @@ module HTTParty
546
578
  perform_request Net::HTTP::Mkcol, path, options, &block
547
579
  end
548
580
 
581
+ def lock(path, options = {}, &block)
582
+ perform_request Net::HTTP::Lock, path, options, &block
583
+ end
584
+
585
+ def unlock(path, options = {}, &block)
586
+ perform_request Net::HTTP::Unlock, path, options, &block
587
+ end
588
+
589
+ def build_request(http_method, path, options = {})
590
+ options = ModuleInheritableAttributes.hash_deep_dup(default_options).merge(options)
591
+ HeadersProcessor.new(headers, options).call
592
+ process_cookies(options)
593
+ Request.new(http_method, path, options)
594
+ end
595
+
549
596
  attr_reader :default_options
550
597
 
551
598
  private
552
599
 
600
+ def validate_timeout_argument(timeout_type, value)
601
+ raise ArgumentError, "#{ timeout_type } must be an integer or float" unless value && (value.is_a?(Integer) || value.is_a?(Float))
602
+ end
603
+
553
604
  def ensure_method_maintained_across_redirects(options)
554
605
  unless options.key?(:maintain_method_across_redirects)
555
606
  options[:maintain_method_across_redirects] = true
@@ -557,27 +608,19 @@ module HTTParty
557
608
  end
558
609
 
559
610
  def perform_request(http_method, path, options, &block) #:nodoc:
560
- options = ModuleInheritableAttributes.hash_deep_dup(default_options).merge(options)
561
- process_headers(options)
562
- process_cookies(options)
563
- Request.new(http_method, path, options).perform(&block)
564
- end
565
-
566
- def process_headers(options)
567
- if options[:headers] && headers.any?
568
- options[:headers] = headers.merge(options[:headers])
569
- end
611
+ build_request(http_method, path, options).perform(&block)
570
612
  end
571
613
 
572
614
  def process_cookies(options) #:nodoc:
573
615
  return unless options[:cookies] || default_cookies.any?
574
616
  options[:headers] ||= headers.dup
575
- options[:headers]["cookie"] = cookies.merge(options.delete(:cookies) || {}).to_cookie_string
617
+ options[:headers]['cookie'] = cookies.merge(options.delete(:cookies) || {}).to_cookie_string
576
618
  end
577
619
 
578
620
  def validate_format
579
621
  if format && parser.respond_to?(:supports_format?) && !parser.supports_format?(format)
580
- raise UnsupportedFormat, "'#{format.inspect}' Must be one of: #{parser.supported_formats.map(&:to_s).sort.join(', ')}"
622
+ supported_format_names = parser.supported_formats.map(&:to_s).sort.join(', ')
623
+ raise UnsupportedFormat, "'#{format.inspect}' Must be one of: #{supported_format_names}"
581
624
  end
582
625
  end
583
626
  end
@@ -632,9 +675,14 @@ module HTTParty
632
675
  def self.options(*args, &block)
633
676
  Basement.options(*args, &block)
634
677
  end
678
+
679
+ def self.build_request(*args, &block)
680
+ Basement.build_request(*args, &block)
681
+ end
635
682
  end
636
683
 
637
684
  require 'httparty/hash_conversions'
685
+ require 'httparty/utils'
638
686
  require 'httparty/exceptions'
639
687
  require 'httparty/parser'
640
688
  require 'httparty/request'
data/script/release CHANGED
@@ -18,9 +18,9 @@ gem_name=httparty
18
18
  rm -rf $gem_name-*.gem
19
19
  gem build -q $gem_name.gemspec
20
20
 
21
- # Make sure we're on the master branch.
22
- (git branch | grep -q '* master') || {
23
- echo "Only release from the master branch."
21
+ # Make sure we're on the main branch.
22
+ (git branch | grep -q '* main') || {
23
+ echo "Only release from the main branch."
24
24
  exit 1
25
25
  }
26
26
 
@@ -39,4 +39,4 @@ git fetch -t origin
39
39
 
40
40
  # Tag it and bag it.
41
41
  gem push $gem_name-*.gem && git tag "$tag" &&
42
- git push origin master && git push origin "$tag"
42
+ git push origin main && git push origin "$tag"
@@ -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,16 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.2
4
+ version: 0.22.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: 2018-03-30 00:00:00.000000000 Z
12
+ date: 2024-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: csv
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: multi_xml
16
30
  requirement: !ruby/object:Gem::Requirement
@@ -25,6 +39,20 @@ dependencies:
25
39
  - - ">="
26
40
  - !ruby/object:Gem::Version
27
41
  version: 0.5.2
42
+ - !ruby/object:Gem::Dependency
43
+ name: mini_mime
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 1.0.0
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.0.0
28
56
  description: Makes http fun! Also, makes consuming restful web services dead easy.
29
57
  email:
30
58
  - nunemaker@gmail.com
@@ -33,11 +61,12 @@ executables:
33
61
  extensions: []
34
62
  extra_rdoc_files: []
35
63
  files:
64
+ - ".editorconfig"
65
+ - ".github/dependabot.yml"
66
+ - ".github/workflows/ci.yml"
36
67
  - ".gitignore"
37
68
  - ".rubocop.yml"
38
69
  - ".rubocop_todo.yml"
39
- - ".simplecov"
40
- - ".travis.yml"
41
70
  - CONTRIBUTING.md
42
71
  - Changelog.md
43
72
  - Gemfile
@@ -51,13 +80,18 @@ files:
51
80
  - examples/README.md
52
81
  - examples/aaws.rb
53
82
  - examples/basic.rb
83
+ - examples/body_stream.rb
54
84
  - examples/crack.rb
55
85
  - examples/custom_parsers.rb
56
86
  - examples/delicious.rb
57
87
  - examples/google.rb
58
88
  - examples/headers_and_user_agents.rb
89
+ - examples/idn.rb
59
90
  - examples/logging.rb
91
+ - examples/microsoft_graph.rb
92
+ - examples/multipart.rb
60
93
  - examples/nokogiri_html_parser.rb
94
+ - examples/peer_cert.rb
61
95
  - examples/rescue_json.rb
62
96
  - examples/rubyurl.rb
63
97
  - examples/stackexchange.rb
@@ -65,29 +99,18 @@ files:
65
99
  - examples/tripit_sign_in.rb
66
100
  - examples/twitter.rb
67
101
  - examples/whoismyrep.rb
68
- - features/basic_authentication.feature
69
- - features/command_line.feature
70
- - features/deals_with_http_error_codes.feature
71
- - features/digest_authentication.feature
72
- - features/handles_compressed_responses.feature
73
- - features/handles_multiple_formats.feature
74
- - features/steps/env.rb
75
- - features/steps/httparty_response_steps.rb
76
- - features/steps/httparty_steps.rb
77
- - features/steps/mongrel_helper.rb
78
- - features/steps/remote_service_steps.rb
79
- - features/supports_read_timeout_option.feature
80
- - features/supports_redirection.feature
81
- - features/supports_timeout_option.feature
82
102
  - httparty.gemspec
83
103
  - lib/httparty.rb
84
104
  - lib/httparty/connection_adapter.rb
85
105
  - lib/httparty/cookie_hash.rb
106
+ - lib/httparty/decompressor.rb
86
107
  - lib/httparty/exceptions.rb
87
108
  - lib/httparty/hash_conversions.rb
109
+ - lib/httparty/headers_processor.rb
88
110
  - lib/httparty/logger/apache_formatter.rb
89
111
  - lib/httparty/logger/curl_formatter.rb
90
112
  - lib/httparty/logger/logger.rb
113
+ - lib/httparty/logger/logstash_formatter.rb
91
114
  - lib/httparty/module_inheritable_attributes.rb
92
115
  - lib/httparty/net_digest_auth.rb
93
116
  - lib/httparty/parser.rb
@@ -96,45 +119,14 @@ files:
96
119
  - lib/httparty/request/multipart_boundary.rb
97
120
  - lib/httparty/response.rb
98
121
  - lib/httparty/response/headers.rb
122
+ - lib/httparty/response_fragment.rb
123
+ - lib/httparty/text_encoder.rb
124
+ - lib/httparty/utils.rb
99
125
  - lib/httparty/version.rb
100
126
  - script/release
101
- - spec/fixtures/delicious.xml
102
- - spec/fixtures/empty.xml
103
- - spec/fixtures/google.html
104
- - spec/fixtures/ssl/generate.sh
105
- - spec/fixtures/ssl/generated/bogushost.crt
106
- - spec/fixtures/ssl/generated/ca.crt
107
- - spec/fixtures/ssl/generated/ca.key
108
- - spec/fixtures/ssl/generated/selfsigned.crt
109
- - spec/fixtures/ssl/generated/server.crt
110
- - spec/fixtures/ssl/generated/server.key
111
- - spec/fixtures/ssl/openssl-exts.cnf
112
- - spec/fixtures/tiny.gif
113
- - spec/fixtures/twitter.csv
114
- - spec/fixtures/twitter.json
115
- - spec/fixtures/twitter.xml
116
- - spec/fixtures/undefined_method_add_node_for_nil.xml
117
- - spec/httparty/connection_adapter_spec.rb
118
- - spec/httparty/cookie_hash_spec.rb
119
- - spec/httparty/exception_spec.rb
120
- - spec/httparty/hash_conversions_spec.rb
121
- - spec/httparty/logger/apache_formatter_spec.rb
122
- - spec/httparty/logger/curl_formatter_spec.rb
123
- - spec/httparty/logger/logger_spec.rb
124
- - spec/httparty/net_digest_auth_spec.rb
125
- - spec/httparty/parser_spec.rb
126
- - spec/httparty/request/body_spec.rb
127
- - spec/httparty/request_spec.rb
128
- - spec/httparty/response_spec.rb
129
- - spec/httparty/ssl_spec.rb
130
- - spec/httparty_spec.rb
131
- - spec/spec_helper.rb
132
- - spec/support/ssl_test_helper.rb
133
- - spec/support/ssl_test_server.rb
134
- - spec/support/stub_response.rb
135
127
  - website/css/common.css
136
128
  - website/index.html
137
- homepage: http://jnunemaker.github.com/httparty
129
+ homepage: https://github.com/jnunemaker/httparty
138
130
  licenses:
139
131
  - MIT
140
132
  metadata: {}
@@ -146,64 +138,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
138
  requirements:
147
139
  - - ">="
148
140
  - !ruby/object:Gem::Version
149
- version: 2.0.0
141
+ version: 2.7.0
150
142
  required_rubygems_version: !ruby/object:Gem::Requirement
151
143
  requirements:
152
144
  - - ">="
153
145
  - !ruby/object:Gem::Version
154
146
  version: '0'
155
147
  requirements: []
156
- rubyforge_project:
157
- rubygems_version: 2.6.14
158
- signing_key:
148
+ rubygems_version: 3.3.7
149
+ signing_key:
159
150
  specification_version: 4
160
151
  summary: Makes http fun! Also, makes consuming restful web services dead easy.
161
- test_files:
162
- - features/basic_authentication.feature
163
- - features/command_line.feature
164
- - features/deals_with_http_error_codes.feature
165
- - features/digest_authentication.feature
166
- - features/handles_compressed_responses.feature
167
- - features/handles_multiple_formats.feature
168
- - features/steps/env.rb
169
- - features/steps/httparty_response_steps.rb
170
- - features/steps/httparty_steps.rb
171
- - features/steps/mongrel_helper.rb
172
- - features/steps/remote_service_steps.rb
173
- - features/supports_read_timeout_option.feature
174
- - features/supports_redirection.feature
175
- - features/supports_timeout_option.feature
176
- - spec/fixtures/delicious.xml
177
- - spec/fixtures/empty.xml
178
- - spec/fixtures/google.html
179
- - spec/fixtures/ssl/generate.sh
180
- - spec/fixtures/ssl/generated/bogushost.crt
181
- - spec/fixtures/ssl/generated/ca.crt
182
- - spec/fixtures/ssl/generated/ca.key
183
- - spec/fixtures/ssl/generated/selfsigned.crt
184
- - spec/fixtures/ssl/generated/server.crt
185
- - spec/fixtures/ssl/generated/server.key
186
- - spec/fixtures/ssl/openssl-exts.cnf
187
- - spec/fixtures/tiny.gif
188
- - spec/fixtures/twitter.csv
189
- - spec/fixtures/twitter.json
190
- - spec/fixtures/twitter.xml
191
- - spec/fixtures/undefined_method_add_node_for_nil.xml
192
- - spec/httparty/connection_adapter_spec.rb
193
- - spec/httparty/cookie_hash_spec.rb
194
- - spec/httparty/exception_spec.rb
195
- - spec/httparty/hash_conversions_spec.rb
196
- - spec/httparty/logger/apache_formatter_spec.rb
197
- - spec/httparty/logger/curl_formatter_spec.rb
198
- - spec/httparty/logger/logger_spec.rb
199
- - spec/httparty/net_digest_auth_spec.rb
200
- - spec/httparty/parser_spec.rb
201
- - spec/httparty/request/body_spec.rb
202
- - spec/httparty/request_spec.rb
203
- - spec/httparty/response_spec.rb
204
- - spec/httparty/ssl_spec.rb
205
- - spec/httparty_spec.rb
206
- - spec/spec_helper.rb
207
- - spec/support/ssl_test_helper.rb
208
- - spec/support/ssl_test_server.rb
209
- - spec/support/stub_response.rb
152
+ test_files: []
data/.simplecov DELETED
@@ -1 +0,0 @@
1
- SimpleCov.start "test_frameworks"
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 2.1.10
5
- - 2.2.9
6
- - 2.3.6
7
- - 2.4.3
8
- - 2.5.0
9
- bundler_args: --without development
10
- before_install: gem install bundler
@@ -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'
@@ -1,95 +0,0 @@
1
- @command_line
2
- Feature: Command Line
3
-
4
- As a developer
5
- I want to be able to harness the power of HTTParty from the command line
6
- Because that would make quick testing and debugging easy
7
-
8
- Scenario: Show help information
9
- When I run `httparty --help`
10
- Then the output should contain "-f, --format [FORMAT]"
11
-
12
- Scenario: Show current version
13
- When I run `httparty --version`
14
- Then the output should contain "Version:"
15
- And the output should not contain "You need to provide a URL"
16
-
17
- Scenario: Make a get request
18
- Given a remote deflate service on port '4001'
19
- And the response from the service has a body of 'GET request'
20
- And that service is accessed at the path '/fun'
21
- When I run `httparty http://0.0.0.0:4001/fun`
22
- Then the output should contain "GET request"
23
-
24
- Scenario: Make a post request
25
- Given a remote deflate service on port '4002'
26
- And the response from the service has a body of 'POST request'
27
- And that service is accessed at the path '/fun'
28
- When I run `httparty http://0.0.0.0:4002/fun --action post --data "a=1&b=2"`
29
- Then the output should contain "POST request"
30
-
31
- Scenario: Make a put request
32
- Given a remote deflate service on port '4003'
33
- And the response from the service has a body of 'PUT request'
34
- And that service is accessed at the path '/fun'
35
- When I run `httparty http://0.0.0.0:4003/fun --action put --data "a=1&b=2"`
36
- Then the output should contain "PUT request"
37
-
38
- Scenario: Make a delete request
39
- Given a remote deflate service on port '4004'
40
- And the response from the service has a body of 'DELETE request'
41
- And that service is accessed at the path '/fun'
42
- When I run `httparty http://0.0.0.0:4004/fun --action delete`
43
- Then the output should contain "DELETE request"
44
-
45
- Scenario: Set a verbose mode
46
- Given a remote deflate service on port '4005'
47
- And the response from the service has a body of 'Some request'
48
- And that service is accessed at the path '/fun'
49
- When I run `httparty http://0.0.0.0:4005/fun --verbose`
50
- Then the output should contain "content-length"
51
-
52
- Scenario: Use service with basic authentication
53
- Given a remote deflate service on port '4006'
54
- And the response from the service has a body of 'Successfull authentication'
55
- And that service is accessed at the path '/fun'
56
- And that service is protected by Basic Authentication
57
- And that service requires the username 'user' with the password 'pass'
58
- When I run `httparty http://0.0.0.0:4006/fun --user 'user:pass'`
59
- Then the output should contain "Successfull authentication"
60
-
61
- Scenario: Get response in plain format
62
- Given a remote deflate service on port '4007'
63
- And the response from the service has a body of 'Some request'
64
- And that service is accessed at the path '/fun'
65
- When I run `httparty http://0.0.0.0:4007/fun --format plain`
66
- Then the output should contain "Some request"
67
-
68
- Scenario: Get response in json format
69
- Given a remote deflate service on port '4008'
70
- Given a remote service that returns '{ "jennings": "waylon", "cash": "johnny" }'
71
- And that service is accessed at the path '/service.json'
72
- And the response from the service has a Content-Type of 'application/json'
73
- When I run `httparty http://0.0.0.0:4008/service.json --format json`
74
- Then the output should contain '"jennings": "waylon"'
75
-
76
- Scenario: Get response in xml format
77
- Given a remote deflate service on port '4009'
78
- Given a remote service that returns '<singer>waylon jennings</singer>'
79
- And that service is accessed at the path '/service.xml'
80
- And the response from the service has a Content-Type of 'text/xml'
81
- When I run `httparty http://0.0.0.0:4009/service.xml --format xml`
82
- Then the output should contain "<singer>"
83
-
84
- Scenario: Get response in csv format
85
- Given a remote deflate service on port '4010'
86
- Given a remote service that returns:
87
- """
88
- "Last Name","Name"
89
- "jennings","waylon"
90
- "cash","johnny"
91
- """
92
- And that service is accessed at the path '/service.csv'
93
- And the response from the service has a Content-Type of 'application/csv'
94
- When I run `httparty http://0.0.0.0:4010/service.csv --format csv`
95
- Then the output should contain '["Last Name", "Name"]'
@@ -1,26 +0,0 @@
1
- Feature: Deals with HTTP error codes
2
-
3
- As a developer
4
- I want to be informed of non-successful responses
5
- Because sometimes thing explode
6
- And I should probably know what happened
7
-
8
- Scenario: A response of '404 - Not Found'
9
- Given a remote service that returns a 404 status code
10
- And that service is accessed at the path '/404_service.html'
11
- When I call HTTParty#get with '/404_service.html'
12
- Then it should return a response with a 404 response code
13
-
14
- Scenario: A response of '500 - Internal Server Error'
15
- Given a remote service that returns a 500 status code
16
- And that service is accessed at the path '/500_service.html'
17
- When I call HTTParty#get with '/500_service.html'
18
- Then it should return a response with a 500 response code
19
-
20
- Scenario: A non-successful response where I need the body
21
- Given a remote service that returns a 400 status code
22
- And the response from the service has a body of 'Bad response'
23
- And that service is accessed at the path '/400_service.html'
24
- When I call HTTParty#get with '/400_service.html'
25
- Then it should return a response with a 400 response code
26
- And the return value should match 'Bad response'
@@ -1,30 +0,0 @@
1
- Feature: Digest Authentication
2
-
3
- As a developer
4
- I want to be able to use a service that requires Digest Authentication
5
- Because that is not an uncommon requirement
6
-
7
- Scenario: Passing no credentials to a page requiring Digest Authentication
8
- Given a restricted page at '/digest_auth.html'
9
- When I call HTTParty#get with '/digest_auth.html'
10
- Then it should return a response with a 401 response code
11
-
12
- Scenario: Passing proper credentials to a page requiring Digest Authentication
13
- Given a remote service that returns 'Digest Authenticated Page'
14
- And that service is accessed at the path '/digest_auth.html'
15
- And that service is protected by Digest Authentication
16
- And that service requires the username 'jcash' with the password 'maninblack'
17
- When I call HTTParty#get with '/digest_auth.html' and a digest_auth hash:
18
- | username | password |
19
- | jcash | maninblack |
20
- Then the return value should match 'Digest Authenticated Page'
21
-
22
- Scenario: Passing proper credentials to a page requiring Digest Authentication using md5-sess algorithm
23
- Given a remote service that returns 'Digest Authenticated Page Using MD5-sess'
24
- And that service is accessed at the path '/digest_auth.html'
25
- And that service is protected by MD5-sess Digest Authentication
26
- And that service requires the username 'jcash' with the password 'maninblack'
27
- When I call HTTParty#get with '/digest_auth.html' and a digest_auth hash:
28
- | username | password |
29
- | jcash | maninblack |
30
- Then the return value should match 'Digest Authenticated Page Using MD5-sess'