http 4.0.0 → 4.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18081275ee2fbb499b450316f301fc7cac4a35f3e5092fe453fd1fb089a2696b
4
- data.tar.gz: 0a3c8b1dd2fa6bc5e68ed518552b4e4e3be8a517fe55fd6cb2b32650612d42ca
3
+ metadata.gz: 6b4b0a992f25d4d013ad17cc731ef43b9a77bce5326989ddfcce64e0dac136fc
4
+ data.tar.gz: 7db71f7b6038af882c3951c894d38eff1e54642fbd1025644cb2756e6ea3abe9
5
5
  SHA512:
6
- metadata.gz: 35f037dc6661cc33147b40647c8faf78a1b881611672c806e529c75f28ab86fc4e9a37e592036a7f22bb5423203d0b6d62dfcc2335016424f8e4fdceccc7b65f
7
- data.tar.gz: c7f299760ef14e5cf40f906520fabfaf2a845449686883f0a6512160f99fc0ff3ee73c8d3bab1b4d6337548e7bff158c23bc41bde843ba8f0dbc50649b131993
6
+ metadata.gz: 1566faa35cdf35dcef2c54cd88c7a9f3768c0e6ed1627e1fbc8af49d0a3b1aab84675bc065a28213f85d43d672779c6778f5dd661b51360116e8bedbc9dc48de
7
+ data.tar.gz: 61b6da199935be564e142a2a791374a652bda85ee142384a7d21fa62fbbf6b86167239332f10e67af39a0b719222f216eca3f7390ac72b7f624b95139eb8b852
@@ -6,7 +6,7 @@ cache: bundler
6
6
  before_install:
7
7
  - gem update --system
8
8
  - gem --version
9
- - gem install bundler --no-rdoc --no-ri
9
+ - gem install bundler
10
10
  - bundle --version
11
11
 
12
12
  install: bundle install --without development doc
data/CHANGES.md CHANGED
@@ -1,5 +1,22 @@
1
+ ## 4.0.1 (2019-01-14)
2
+
3
+ * [#515](https://github.com/httprb/http/pull/515)
4
+ Fix `#build_request` and `#request` to respect default options.
5
+ ([@RickCSong])
6
+
7
+
1
8
  ## 4.0.0 (2018-10-15)
2
9
 
10
+ * [#482](https://github.com/httprb/http/pull/482)
11
+ [#499](https://github.com/httprb/http/pull/499)
12
+ Introduce new features injection API with 2 new feaures: instrumentation
13
+ (compatible with ActiveSupport::Notification) and logging.
14
+ ([@paul])
15
+
16
+ * [#473](https://github.com/httprb/http/pull/473)
17
+ Handle early responses.
18
+ ([@janko-m])
19
+
3
20
  * [#468](https://github.com/httprb/http/pull/468)
4
21
  Rewind `HTTP::Request::Body#source` once `#each` is complete.
5
22
  ([@ixti])
@@ -709,3 +726,5 @@ end
709
726
  [@scarfacedeb]: https://github.com/scarfacedeb
710
727
  [@mikegee]: https://github.com/mikegee
711
728
  [@tycoon]: https://github.com/tycooon
729
+ [@paul]: https://github.com/paul
730
+ [@RickCSong]: https://github.com/RickCSong
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # ![http.rb](https://raw.github.com/httprb/http.rb/master/logo.png)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/http.svg)](https://rubygems.org/gems/http)
4
- [![Build Status](https://secure.travis-ci.org/httprb/http.svg?branch=master)](https://travis-ci.org/httprb/http)
5
- [![Code Climate](https://codeclimate.com/github/httprb/http.svg?branch=master)](https://codeclimate.com/github/httprb/http)
6
- [![Coverage Status](https://coveralls.io/repos/httprb/http/badge.svg?branch=master)](https://coveralls.io/r/httprb/http)
4
+ [![Build Status](https://secure.travis-ci.org/httprb/http.svg?branch=4-x-stable)](https://travis-ci.org/httprb/http)
5
+ [![Code Climate](https://codeclimate.com/github/httprb/http.svg?branch=4-x-stable)](https://codeclimate.com/github/httprb/http)
6
+ [![Coverage Status](https://coveralls.io/repos/httprb/http/badge.svg?branch=4-x-stable)](https://coveralls.io/r/httprb/http)
7
7
  [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/httprb/http/blob/master/LICENSE.txt)
8
8
 
9
9
  [Documentation]
10
10
 
11
- _NOTE: This is the 4.x **development** branch. For the 3.x **stable** branch, please see:_
11
+ _NOTE: This is the 4.x **stable** branch. For the 3.x **stable** branch, please see:_
12
12
 
13
13
  https://github.com/httprb/http/tree/3-x-stable
14
14
 
@@ -25,7 +25,7 @@ Gem::Specification.new do |gem|
25
25
  gem.require_paths = ["lib"]
26
26
  gem.version = HTTP::VERSION
27
27
 
28
- gem.required_ruby_version = ">= 2.2"
28
+ gem.required_ruby_version = ">= 2.3"
29
29
 
30
30
  gem.add_runtime_dependency "http_parser.rb", "~> 0.6.0"
31
31
  gem.add_runtime_dependency "http-form_data", "~> 2.0"
@@ -70,19 +70,15 @@ module HTTP
70
70
  end
71
71
 
72
72
  # Make an HTTP request with the given verb
73
- # @param verb
74
- # @param uri
75
- # @option options [Hash]
76
- def request(verb, uri, options = {}) # rubocop:disable Style/OptionHash
77
- branch(options).request verb, uri
73
+ # @param (see Client#request)
74
+ def request(*args)
75
+ branch(default_options).request(*args)
78
76
  end
79
77
 
80
78
  # Prepare an HTTP request with the given verb
81
- # @param verb
82
- # @param uri
83
- # @option options [Hash]
84
- def build_request(verb, uri, options = {}) # rubocop:disable Style/OptionHash
85
- branch(options).build_request verb, uri
79
+ # @param (see Client#build_request)
80
+ def build_request(*args)
81
+ branch(default_options).build_request(*args)
86
82
  end
87
83
 
88
84
  # @overload timeout(options = {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTP
4
- VERSION = "4.0.0"
4
+ VERSION = "4.0.1"
5
5
  end
@@ -1,34 +1,42 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "logger"
4
+
3
5
  RSpec.describe HTTP::Features::Logging do
4
- subject(:feature) { HTTP::Features::Logging.new(:logger => logger) }
5
- let(:logger) { TestLogger.new }
6
+ subject(:feature) do
7
+ logger = Logger.new(logdev)
8
+ logger.formatter = ->(severity, _, _, message) do
9
+ format("** %s **\n%s\n", severity, message)
10
+ end
11
+
12
+ described_class.new(:logger => logger)
13
+ end
14
+
15
+ let(:logdev) { StringIO.new }
6
16
 
7
17
  describe "logging the request" do
8
18
  let(:request) do
9
19
  HTTP::Request.new(
10
- :verb => :post,
11
- :uri => "https://example.com/",
12
- :headers => {:accept => "application/json"},
13
- :body => '{"hello": "world!"}'
20
+ :verb => :post,
21
+ :uri => "https://example.com/",
22
+ :headers => {:accept => "application/json"},
23
+ :body => '{"hello": "world!"}'
14
24
  )
15
25
  end
16
26
 
17
27
  it "should log the request" do
18
28
  feature.wrap_request(request)
19
29
 
20
- expect(logger.output).to eq(
21
- [
22
- "> POST https://example.com/",
23
- <<~REQ.strip
24
- Accept: application/json
25
- Host: example.com
26
- User-Agent: http.rb/4.0.0.dev
30
+ expect(logdev.string).to eq <<~OUTPUT
31
+ ** INFO **
32
+ > POST https://example.com/
33
+ ** DEBUG **
34
+ Accept: application/json
35
+ Host: example.com
36
+ User-Agent: http.rb/#{HTTP::VERSION}
27
37
 
28
- {"hello": "world!"}
29
- REQ
30
- ]
31
- )
38
+ {"hello": "world!"}
39
+ OUTPUT
32
40
  end
33
41
  end
34
42
 
@@ -36,39 +44,24 @@ RSpec.describe HTTP::Features::Logging do
36
44
  let(:response) do
37
45
  HTTP::Response.new(
38
46
  :version => "1.1",
39
- :uri => "https://example.com",
40
- :status => 200,
47
+ :uri => "https://example.com",
48
+ :status => 200,
41
49
  :headers => {:content_type => "application/json"},
42
- :body => '{"success": true}'
50
+ :body => '{"success": true}'
43
51
  )
44
52
  end
45
53
 
46
54
  it "should log the response" do
47
55
  feature.wrap_response(response)
48
56
 
49
- expect(logger.output).to eq(
50
- [
51
- "< 200 OK",
52
- <<~REQ.strip
53
- Content-Type: application/json
54
-
55
- {"success": true}
56
- REQ
57
- ]
58
- )
59
- end
60
- end
61
-
62
- class TestLogger
63
- attr_reader :output
64
- def initialize
65
- @output = []
66
- end
57
+ expect(logdev.string).to eq <<~OUTPUT
58
+ ** INFO **
59
+ < 200 OK
60
+ ** DEBUG **
61
+ Content-Type: application/json
67
62
 
68
- %w[fatal error warn info debug].each do |level|
69
- define_method(level.to_sym) do |*args, &block|
70
- @output << (block ? block.call : args)
71
- end
63
+ {"success": true}
64
+ OUTPUT
72
65
  end
73
66
  end
74
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-10-14 00:00:00.000000000 Z
14
+ date: 2019-01-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: http_parser.rb
@@ -190,15 +190,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - ">="
192
192
  - !ruby/object:Gem::Version
193
- version: '2.2'
193
+ version: '2.3'
194
194
  required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  requirements:
196
196
  - - ">="
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubyforge_project:
201
- rubygems_version: 2.7.6
200
+ rubygems_version: 3.0.1
202
201
  signing_key:
203
202
  specification_version: 4
204
203
  summary: HTTP should be easy