http.rb 0.18.0 → 0.18.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 +4 -4
- data/CHANGELOG +12 -0
- data/README.md +1 -3
- data/lib/HTTP/VERSION.rb +1 -1
- data/lib/HTTP/verbs.rb +1 -2
- metadata +1 -4
- data/lib/Net/HTTP/Report.rb +0 -14
- data/spec/HTTP/propfind_spec.rb +0 -122
- data/spec/Net/HTTP/Report_spec.rb +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cf46d2fcd2e4e18c1bd5fb1245da1156b14d694871970fb6d827d5a79f2a533
|
|
4
|
+
data.tar.gz: 786e1c2b4fc5314e2626f466bfd249d7a24ea80b607ed0f3c67333c6220147e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86963812021231537e441627cbe6e617920409c465010296e4f513f838c40df51005edfc25083ad03348566de02c94a80ae9a3ccfa26c956abe00274425857aa
|
|
7
|
+
data.tar.gz: d5b6e217124fffa5ee8a23e78c316e9d8bbce7cfe8523613923ac18b34bfa74e003a21294b793ddca56785261ea8f765e158adae3b83663d732aa19c12c38fcc
|
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
# 20260508
|
|
4
|
+
# 0.18.1: Remove incorrectly added WebDAV verbs.
|
|
5
|
+
1. - lib/Net/HTTP/Report.rb
|
|
6
|
+
2. ~ HTTP::VERBS: - require_relative '../Net/HTTP/Report'
|
|
7
|
+
3. ~ HTTP::VERBS::WITH_BODY: - propfind, proppatch, mkcol, copy, move, lock, unlock, report
|
|
8
|
+
4. - spec/HTTP/propfind_spec.rb
|
|
9
|
+
5. - spec/Net/HTTP/Report_spec.rb
|
|
10
|
+
6. ~ HTTP::VERSION: /0.18.0/0.18.1/
|
|
11
|
+
7. ~ CHANGELOG: + 0.18.1 entry
|
|
12
|
+
|
|
1
13
|
# 20260507
|
|
2
14
|
# 0.18.0: Add all missing HTTP verbs; use meta-programming to define verb methods.
|
|
3
15
|
1. + HTTP/verbs.rb; including:
|
data/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# http
|
|
2
2
|
|
|
3
|
-
## Description
|
|
4
|
-
|
|
5
3
|
For many years this was a personal library, from around the middle of 2009 from what I can ascertain, though in various guises it may have been as early as late 2007.
|
|
6
4
|
|
|
7
5
|
Like many others before and after me with their respective libraries, I created it to simplify the heinous interface that is Net::HTTP. At the time of it's original creation I was doing a lot of a webscraping and didn't want a half-dozen line setup to make simple requests. It has stood the test of time, for me personally insofar as the interface remaining simpler than most other similar libraries, though it is also less full featured, but nevertheless for it's tiny size it packs in quite a bit.
|
|
@@ -247,7 +245,7 @@ verify_mode
|
|
|
247
245
|
|
|
248
246
|
## Contributing
|
|
249
247
|
|
|
250
|
-
1. Fork it (
|
|
248
|
+
1. Fork it [https://github.com/thoran/http/fork](https://github.com/thoran/http/fork)
|
|
251
249
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
252
250
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
253
251
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/HTTP/VERSION.rb
CHANGED
data/lib/HTTP/verbs.rb
CHANGED
|
@@ -5,14 +5,13 @@ require 'json'
|
|
|
5
5
|
require 'net/http'
|
|
6
6
|
|
|
7
7
|
require_relative '../Hash/x_www_form_urlencode'
|
|
8
|
-
require_relative '../Net/HTTP/Report'
|
|
9
8
|
require_relative './request'
|
|
10
9
|
require_relative '../String/to_const'
|
|
11
10
|
|
|
12
11
|
module HTTP
|
|
13
12
|
module VERBS
|
|
14
13
|
WITHOUT_BODY = %i{get delete head options trace}
|
|
15
|
-
WITH_BODY = %i{post put patch
|
|
14
|
+
WITH_BODY = %i{post put patch}
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
VERBS::WITHOUT_BODY.each do |verb|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: http.rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.18.
|
|
4
|
+
version: 0.18.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoran
|
|
@@ -83,7 +83,6 @@ files:
|
|
|
83
83
|
- lib/HTTP/request.rb
|
|
84
84
|
- lib/HTTP/verbs.rb
|
|
85
85
|
- lib/Hash/x_www_form_urlencode.rb
|
|
86
|
-
- lib/Net/HTTP/Report.rb
|
|
87
86
|
- lib/Net/HTTP/set_options.rb
|
|
88
87
|
- lib/Net/HTTPRequest/set_headers.rb
|
|
89
88
|
- lib/Net/HTTPResponse/StatusPredicates.rb
|
|
@@ -98,9 +97,7 @@ files:
|
|
|
98
97
|
- spec/HTTP/get_spec.rb
|
|
99
98
|
- spec/HTTP/head_spec.rb
|
|
100
99
|
- spec/HTTP/post_spec.rb
|
|
101
|
-
- spec/HTTP/propfind_spec.rb
|
|
102
100
|
- spec/HTTP/put_spec.rb
|
|
103
|
-
- spec/Net/HTTP/Report_spec.rb
|
|
104
101
|
- spec/spec_helper.rb
|
|
105
102
|
homepage: http://github.com/thoran/HTTP
|
|
106
103
|
licenses:
|
data/lib/Net/HTTP/Report.rb
DELETED
data/spec/HTTP/propfind_spec.rb
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
# spec/HTTP/propfind_spec.rb
|
|
2
|
-
|
|
3
|
-
require_relative '../spec_helper'
|
|
4
|
-
require 'http'
|
|
5
|
-
|
|
6
|
-
describe ".propfind" do
|
|
7
|
-
context "with uri-only supplied" do
|
|
8
|
-
before do
|
|
9
|
-
stub_request(:propfind, 'http://example.com/dav/').
|
|
10
|
-
to_return(status: 207, body: '<multistatus/>', headers: {})
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
context "uri as a string" do
|
|
14
|
-
let(:uri){'http://example.com/dav/'}
|
|
15
|
-
|
|
16
|
-
it "returns a response" do
|
|
17
|
-
response = HTTP.propfind(uri)
|
|
18
|
-
expect(response.code).to eq('207')
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
context "uri as a URI" do
|
|
23
|
-
let(:uri){URI.parse('http://example.com/dav/')}
|
|
24
|
-
|
|
25
|
-
it "returns a response" do
|
|
26
|
-
response = HTTP.propfind(uri)
|
|
27
|
-
expect(response.code).to eq('207')
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
context "with an XML body" do
|
|
33
|
-
let(:uri){'http://example.com/dav/'}
|
|
34
|
-
let(:xml) do
|
|
35
|
-
'<?xml version="1.0" encoding="UTF-8"?><d:propfind xmlns:d="DAV:"><d:prop><d:displayname/></d:prop></d:propfind>'
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
before do
|
|
39
|
-
stub_request(:propfind, 'http://example.com/dav/').
|
|
40
|
-
with(body: xml).
|
|
41
|
-
to_return(status: 207, body: '<multistatus/>', headers: {})
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "sends the XML body" do
|
|
45
|
-
response = HTTP.propfind(uri, xml, {'Content-Type' => 'application/xml'})
|
|
46
|
-
expect(response.code).to eq('207')
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
context "with headers supplied" do
|
|
51
|
-
let(:uri){'http://example.com/dav/'}
|
|
52
|
-
|
|
53
|
-
before do
|
|
54
|
-
stub_request(:propfind, 'http://example.com/dav/').
|
|
55
|
-
with(headers: {'Depth' => '1', 'Content-Type' => 'application/xml'}).
|
|
56
|
-
to_return(status: 207, body: '<multistatus/>', headers: {})
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it "sets the headers on the request" do
|
|
60
|
-
response = HTTP.propfind(uri, {}, {'Depth' => '1', 'Content-Type' => 'application/xml'})
|
|
61
|
-
expect(response.code).to eq('207')
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
context "with options supplied" do
|
|
66
|
-
let(:uri){'http://example.com/dav/'}
|
|
67
|
-
|
|
68
|
-
before do
|
|
69
|
-
stub_request(:propfind, 'https://example.com:80/dav/').
|
|
70
|
-
to_return(status: 207, body: '<multistatus/>', headers: {})
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it "sets the use_ssl option on the Net::HTTP instance" do
|
|
74
|
-
response = HTTP.propfind(uri, {}, {}, {use_ssl: true})
|
|
75
|
-
expect(response.code).to eq('207')
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
context "with block supplied" do
|
|
80
|
-
let(:uri){'http://example.com/dav/'}
|
|
81
|
-
|
|
82
|
-
before do
|
|
83
|
-
stub_request(:propfind, 'http://example.com/dav/').
|
|
84
|
-
to_return(status: 207, body: '<multistatus/>', headers: {})
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
it "yields an instance of Net::HTTPResponse" do
|
|
88
|
-
expect{|b| HTTP.propfind(uri, &b)}.to yield_with_args(Net::HTTPResponse)
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
context "with redirection" do
|
|
93
|
-
let(:request_uri){'http://example.com/dav/'}
|
|
94
|
-
let(:redirect_uri){'http://redirected.com/dav/'}
|
|
95
|
-
|
|
96
|
-
before do
|
|
97
|
-
stub_request(:propfind, request_uri).
|
|
98
|
-
to_return(status: 301, headers: {'location' => redirect_uri})
|
|
99
|
-
stub_request(:get, redirect_uri).
|
|
100
|
-
to_return(status: 200, body: '', headers: {})
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
it "follows the redirect" do
|
|
104
|
-
response = HTTP.propfind(request_uri)
|
|
105
|
-
expect(response.success?).to eq(true)
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
context "no_redirect true" do
|
|
110
|
-
let(:request_uri){'http://example.com/dav/'}
|
|
111
|
-
|
|
112
|
-
before do
|
|
113
|
-
stub_request(:propfind, request_uri).
|
|
114
|
-
to_return(status: 301, headers: {'location' => 'http://redirected.com/dav/'})
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
it "returns the redirect response" do
|
|
118
|
-
response = HTTP.propfind(request_uri, {}, {}, {no_redirect: true})
|
|
119
|
-
expect(response.redirection?).to eq(true)
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# spec/Net/HTTP/Report_spec.rb
|
|
2
|
-
|
|
3
|
-
require_relative '../../spec_helper'
|
|
4
|
-
require 'Net/HTTP/Report'
|
|
5
|
-
|
|
6
|
-
describe Net::HTTP::Report do
|
|
7
|
-
it "is a subclass of Net::HTTPRequest" do
|
|
8
|
-
expect(Net::HTTP::Report).to be <= Net::HTTPRequest
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "has the correct METHOD" do
|
|
12
|
-
expect(Net::HTTP::Report::METHOD).to eq('REPORT')
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "accepts a body" do
|
|
16
|
-
expect(Net::HTTP::Report::REQUEST_HAS_BODY).to eq(true)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "expects a response body" do
|
|
20
|
-
expect(Net::HTTP::Report::RESPONSE_HAS_BODY).to eq(true)
|
|
21
|
-
end
|
|
22
|
-
end
|