httparty 0.16.2 → 0.20.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.

Potentially problematic release.


This version of httparty might be problematic. Click here for more details.

Files changed (92) hide show
  1. checksums.yaml +5 -5
  2. data/.editorconfig +18 -0
  3. data/.github/workflows/ci.yml +23 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop_todo.yml +1 -1
  6. data/Changelog.md +72 -0
  7. data/Gemfile +5 -0
  8. data/README.md +5 -5
  9. data/docs/README.md +70 -5
  10. data/examples/README.md +28 -11
  11. data/examples/aaws.rb +6 -2
  12. data/examples/body_stream.rb +14 -0
  13. data/examples/idn.rb +10 -0
  14. data/examples/microsoft_graph.rb +52 -0
  15. data/examples/multipart.rb +22 -0
  16. data/examples/peer_cert.rb +9 -0
  17. data/examples/stream_download.rb +8 -2
  18. data/httparty.gemspec +3 -3
  19. data/lib/httparty/connection_adapter.rb +59 -16
  20. data/lib/httparty/cookie_hash.rb +10 -8
  21. data/lib/httparty/decompressor.rb +92 -0
  22. data/lib/httparty/exceptions.rb +3 -1
  23. data/lib/httparty/hash_conversions.rb +10 -4
  24. data/lib/httparty/headers_processor.rb +32 -0
  25. data/lib/httparty/logger/apache_formatter.rb +31 -6
  26. data/lib/httparty/logger/curl_formatter.rb +9 -7
  27. data/lib/httparty/logger/logger.rb +5 -1
  28. data/lib/httparty/logger/logstash_formatter.rb +61 -0
  29. data/lib/httparty/module_inheritable_attributes.rb +6 -4
  30. data/lib/httparty/net_digest_auth.rb +15 -15
  31. data/lib/httparty/parser.rb +9 -5
  32. data/lib/httparty/request/body.rb +46 -27
  33. data/lib/httparty/request/multipart_boundary.rb +2 -0
  34. data/lib/httparty/request.rb +75 -96
  35. data/lib/httparty/response/headers.rb +4 -2
  36. data/lib/httparty/response.rb +51 -8
  37. data/lib/httparty/response_fragment.rb +21 -0
  38. data/lib/httparty/text_encoder.rb +72 -0
  39. data/lib/httparty/utils.rb +13 -0
  40. data/lib/httparty/version.rb +3 -1
  41. data/lib/httparty.rb +70 -24
  42. data/website/css/common.css +1 -1
  43. metadata +33 -104
  44. data/.travis.yml +0 -10
  45. data/features/basic_authentication.feature +0 -20
  46. data/features/command_line.feature +0 -95
  47. data/features/deals_with_http_error_codes.feature +0 -26
  48. data/features/digest_authentication.feature +0 -30
  49. data/features/handles_compressed_responses.feature +0 -27
  50. data/features/handles_multiple_formats.feature +0 -57
  51. data/features/steps/env.rb +0 -27
  52. data/features/steps/httparty_response_steps.rb +0 -56
  53. data/features/steps/httparty_steps.rb +0 -43
  54. data/features/steps/mongrel_helper.rb +0 -127
  55. data/features/steps/remote_service_steps.rb +0 -92
  56. data/features/supports_read_timeout_option.feature +0 -13
  57. data/features/supports_redirection.feature +0 -22
  58. data/features/supports_timeout_option.feature +0 -13
  59. data/spec/fixtures/delicious.xml +0 -23
  60. data/spec/fixtures/empty.xml +0 -0
  61. data/spec/fixtures/google.html +0 -3
  62. data/spec/fixtures/ssl/generate.sh +0 -29
  63. data/spec/fixtures/ssl/generated/bogushost.crt +0 -13
  64. data/spec/fixtures/ssl/generated/ca.crt +0 -16
  65. data/spec/fixtures/ssl/generated/ca.key +0 -15
  66. data/spec/fixtures/ssl/generated/selfsigned.crt +0 -14
  67. data/spec/fixtures/ssl/generated/server.crt +0 -13
  68. data/spec/fixtures/ssl/generated/server.key +0 -15
  69. data/spec/fixtures/ssl/openssl-exts.cnf +0 -9
  70. data/spec/fixtures/tiny.gif +0 -0
  71. data/spec/fixtures/twitter.csv +0 -2
  72. data/spec/fixtures/twitter.json +0 -1
  73. data/spec/fixtures/twitter.xml +0 -403
  74. data/spec/fixtures/undefined_method_add_node_for_nil.xml +0 -2
  75. data/spec/httparty/connection_adapter_spec.rb +0 -498
  76. data/spec/httparty/cookie_hash_spec.rb +0 -100
  77. data/spec/httparty/exception_spec.rb +0 -45
  78. data/spec/httparty/hash_conversions_spec.rb +0 -56
  79. data/spec/httparty/logger/apache_formatter_spec.rb +0 -41
  80. data/spec/httparty/logger/curl_formatter_spec.rb +0 -119
  81. data/spec/httparty/logger/logger_spec.rb +0 -38
  82. data/spec/httparty/net_digest_auth_spec.rb +0 -270
  83. data/spec/httparty/parser_spec.rb +0 -190
  84. data/spec/httparty/request/body_spec.rb +0 -60
  85. data/spec/httparty/request_spec.rb +0 -1312
  86. data/spec/httparty/response_spec.rb +0 -347
  87. data/spec/httparty/ssl_spec.rb +0 -74
  88. data/spec/httparty_spec.rb +0 -896
  89. data/spec/spec_helper.rb +0 -51
  90. data/spec/support/ssl_test_helper.rb +0 -47
  91. data/spec/support/ssl_test_server.rb +0 -80
  92. data/spec/support/stub_response.rb +0 -49
@@ -1,60 +0,0 @@
1
- require_relative '../../spec_helper'
2
-
3
- RSpec.describe HTTParty::Request::Body do
4
- describe '#call' do
5
- subject { described_class.new(params).call }
6
-
7
- context 'when params is string' do
8
- let(:params) { 'name=Bob%20Jones' }
9
-
10
- it { is_expected.to eq params }
11
- end
12
-
13
- context 'when params is hash' do
14
- let(:params) { { people: ["Bob Jones", "Mike Smith"] } }
15
- let(:converted_params) { "people[]=Bob%20Jones&people[]=Mike%20Smith"}
16
-
17
- it { is_expected.to eq converted_params }
18
-
19
- context 'when params has file' do
20
- before do
21
- allow(HTTParty::Request::MultipartBoundary).
22
- to receive(:generate).and_return("------------------------c772861a5109d5ef")
23
- end
24
-
25
- let(:params) do
26
- {
27
- user: {
28
- avatar: File.open('spec/fixtures/tiny.gif'),
29
- first_name: 'John',
30
- last_name: 'Doe',
31
- enabled: true
32
- }
33
- }
34
- end
35
- let(:multipart_params) do
36
- "--------------------------c772861a5109d5ef\r\n" \
37
- "Content-Disposition: form-data; name=\"user[avatar]\"; filename=\"tiny.gif\"\r\n" \
38
- "Content-Type: application/octet-stream\r\n" \
39
- "\r\n" \
40
- "GIF89a\u0001\u0000\u0001\u0000\u0000\xFF\u0000,\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0000\u0002\u0000;\r\n" \
41
- "--------------------------c772861a5109d5ef\r\n" \
42
- "Content-Disposition: form-data; name=\"user[first_name]\"\r\n" \
43
- "\r\n" \
44
- "John\r\n" \
45
- "--------------------------c772861a5109d5ef\r\n" \
46
- "Content-Disposition: form-data; name=\"user[last_name]\"\r\n" \
47
- "\r\n" \
48
- "Doe\r\n" \
49
- "--------------------------c772861a5109d5ef\r\n" \
50
- "Content-Disposition: form-data; name=\"user[enabled]\"\r\n" \
51
- "\r\n" \
52
- "true\r\n" \
53
- "--------------------------c772861a5109d5ef--\r\n"
54
- end
55
-
56
- it { is_expected.to eq multipart_params }
57
- end
58
- end
59
- end
60
- end