rack-client 0.3.1.pre.e → 0.3.1.pre.f
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -22
- data/lib/rack/client/adapter/base.rb +8 -5
- data/lib/rack/client/adapter/base.rbc +149 -190
- data/lib/rack/client/adapter/simple.rbc +238 -108
- data/lib/rack/client/handler/net_http.rb +2 -2
- data/lib/rack/client/handler/typhoeus.rb +10 -2
- data/lib/rack/client/parser/body_collection.rb +1 -1
- data/lib/rack/client/parser/body_collection.rbc +37 -6
- data/lib/rack/client/version.rb +1 -1
- data/lib/rack/client/version.rbc +2 -2
- data/lib/rack/client.rb +2 -1
- data/lib/rack/client.rbc +14 -8
- metadata +4 -4
@@ -187,7 +187,7 @@ x
|
|
187
187
|
6
|
188
188
|
Simple
|
189
189
|
i
|
190
|
-
|
190
|
+
138
|
191
191
|
5
|
192
192
|
66
|
193
193
|
99
|
@@ -311,6 +311,20 @@ i
|
|
311
311
|
49
|
312
312
|
10
|
313
313
|
4
|
314
|
+
15
|
315
|
+
99
|
316
|
+
7
|
317
|
+
27
|
318
|
+
7
|
319
|
+
28
|
320
|
+
65
|
321
|
+
67
|
322
|
+
49
|
323
|
+
9
|
324
|
+
0
|
325
|
+
49
|
326
|
+
10
|
327
|
+
4
|
314
328
|
11
|
315
329
|
I
|
316
330
|
6
|
@@ -322,7 +336,7 @@ I
|
|
322
336
|
0
|
323
337
|
n
|
324
338
|
p
|
325
|
-
|
339
|
+
29
|
326
340
|
x
|
327
341
|
17
|
328
342
|
CollapsedResponse
|
@@ -1200,8 +1214,8 @@ x
|
|
1200
1214
|
4
|
1201
1215
|
to_s
|
1202
1216
|
s
|
1203
|
-
|
1204
|
-
(url, headers = {}, body_or_params = nil, query_params = {})
|
1217
|
+
90
|
1218
|
+
(url, headers = {}, body_or_params = nil, query_params = {}, &block)
|
1205
1219
|
request('
|
1206
1220
|
x
|
1207
1221
|
6
|
@@ -1506,7 +1520,7 @@ x
|
|
1506
1520
|
13
|
1507
1521
|
request_tuple
|
1508
1522
|
i
|
1509
|
-
|
1523
|
+
154
|
1510
1524
|
23
|
1511
1525
|
1
|
1512
1526
|
10
|
@@ -1547,170 +1561,137 @@ i
|
|
1547
1561
|
19
|
1548
1562
|
4
|
1549
1563
|
15
|
1550
|
-
20
|
1551
|
-
5
|
1552
|
-
49
|
1553
|
-
2
|
1554
|
-
0
|
1555
|
-
9
|
1556
|
-
67
|
1557
|
-
44
|
1558
|
-
43
|
1559
|
-
0
|
1560
|
-
78
|
1561
|
-
49
|
1562
|
-
1
|
1563
|
-
1
|
1564
|
-
20
|
1565
|
-
1
|
1566
|
-
17
|
1567
|
-
2
|
1568
|
-
19
|
1569
|
-
1
|
1570
|
-
15
|
1571
|
-
19
|
1572
|
-
5
|
1573
|
-
15
|
1574
|
-
2
|
1575
|
-
8
|
1576
|
-
68
|
1577
|
-
1
|
1578
|
-
15
|
1579
1564
|
45
|
1580
1565
|
0
|
1581
|
-
|
1566
|
+
2
|
1582
1567
|
20
|
1583
|
-
|
1568
|
+
3
|
1584
1569
|
86
|
1585
|
-
|
1570
|
+
3
|
1586
1571
|
9
|
1587
|
-
|
1572
|
+
53
|
1588
1573
|
20
|
1589
|
-
|
1574
|
+
3
|
1590
1575
|
8
|
1591
|
-
|
1576
|
+
61
|
1592
1577
|
45
|
1578
|
+
4
|
1593
1579
|
5
|
1594
|
-
6
|
1595
1580
|
20
|
1596
|
-
|
1581
|
+
3
|
1597
1582
|
49
|
1598
|
-
|
1583
|
+
6
|
1599
1584
|
1
|
1600
1585
|
19
|
1601
|
-
|
1586
|
+
5
|
1602
1587
|
15
|
1603
1588
|
45
|
1589
|
+
7
|
1604
1590
|
8
|
1605
|
-
9
|
1606
1591
|
20
|
1607
1592
|
0
|
1608
1593
|
49
|
1609
|
-
|
1594
|
+
9
|
1610
1595
|
1
|
1611
1596
|
19
|
1612
|
-
|
1597
|
+
6
|
1613
1598
|
15
|
1614
1599
|
20
|
1615
1600
|
3
|
1616
1601
|
49
|
1617
|
-
|
1602
|
+
10
|
1618
1603
|
0
|
1619
1604
|
9
|
1620
|
-
|
1605
|
+
85
|
1621
1606
|
1
|
1622
1607
|
8
|
1623
|
-
|
1608
|
+
116
|
1624
1609
|
20
|
1625
|
-
|
1610
|
+
6
|
1626
1611
|
45
|
1627
|
-
|
1628
|
-
|
1612
|
+
4
|
1613
|
+
11
|
1629
1614
|
45
|
1630
|
-
|
1631
|
-
|
1615
|
+
4
|
1616
|
+
12
|
1632
1617
|
20
|
1633
|
-
|
1618
|
+
6
|
1634
1619
|
49
|
1635
|
-
|
1620
|
+
13
|
1636
1621
|
0
|
1637
1622
|
49
|
1638
|
-
|
1623
|
+
14
|
1639
1624
|
1
|
1640
|
-
|
1641
|
-
|
1642
|
-
16
|
1625
|
+
20
|
1626
|
+
3
|
1643
1627
|
49
|
1644
|
-
|
1628
|
+
15
|
1645
1629
|
1
|
1646
1630
|
49
|
1647
|
-
|
1631
|
+
16
|
1648
1632
|
1
|
1649
1633
|
13
|
1650
1634
|
18
|
1651
1635
|
2
|
1652
1636
|
49
|
1653
|
-
|
1637
|
+
17
|
1654
1638
|
1
|
1655
1639
|
15
|
1656
1640
|
15
|
1657
1641
|
45
|
1658
1642
|
0
|
1659
|
-
|
1643
|
+
18
|
1660
1644
|
20
|
1661
1645
|
2
|
1662
1646
|
86
|
1663
|
-
|
1647
|
+
3
|
1664
1648
|
9
|
1665
|
-
|
1649
|
+
136
|
1666
1650
|
45
|
1667
|
-
|
1668
|
-
|
1651
|
+
4
|
1652
|
+
19
|
1669
1653
|
20
|
1670
1654
|
2
|
1671
1655
|
49
|
1672
|
-
|
1656
|
+
16
|
1673
1657
|
1
|
1674
1658
|
8
|
1675
|
-
|
1659
|
+
138
|
1676
1660
|
20
|
1677
1661
|
2
|
1678
1662
|
19
|
1679
|
-
|
1663
|
+
7
|
1680
1664
|
15
|
1681
1665
|
20
|
1682
|
-
|
1666
|
+
6
|
1683
1667
|
49
|
1684
|
-
|
1668
|
+
20
|
1685
1669
|
0
|
1686
1670
|
20
|
1687
1671
|
1
|
1688
1672
|
20
|
1689
|
-
|
1673
|
+
7
|
1690
1674
|
35
|
1691
1675
|
3
|
1692
1676
|
11
|
1693
1677
|
11
|
1694
1678
|
I
|
1695
|
-
|
1679
|
+
c
|
1696
1680
|
I
|
1697
|
-
|
1681
|
+
8
|
1698
1682
|
I
|
1699
1683
|
1
|
1700
1684
|
I
|
1701
1685
|
4
|
1702
1686
|
n
|
1703
1687
|
p
|
1704
|
-
|
1688
|
+
21
|
1705
1689
|
x
|
1706
1690
|
4
|
1707
1691
|
Hash
|
1708
1692
|
x
|
1709
1693
|
16
|
1710
1694
|
new_from_literal
|
1711
|
-
x
|
1712
|
-
4
|
1713
|
-
nil?
|
1714
1695
|
n
|
1715
1696
|
x
|
1716
1697
|
3
|
@@ -1741,9 +1722,6 @@ x
|
|
1741
1722
|
18
|
1742
1723
|
parse_nested_query
|
1743
1724
|
x
|
1744
|
-
12
|
1745
|
-
query_phrams
|
1746
|
-
x
|
1747
1725
|
5
|
1748
1726
|
merge
|
1749
1727
|
x
|
@@ -1758,46 +1736,42 @@ x
|
|
1758
1736
|
4
|
1759
1737
|
to_s
|
1760
1738
|
p
|
1761
|
-
|
1739
|
+
15
|
1762
1740
|
I
|
1763
1741
|
0
|
1764
1742
|
I
|
1765
|
-
3c
|
1766
|
-
I
|
1767
|
-
28
|
1768
|
-
I
|
1769
1743
|
3d
|
1770
1744
|
I
|
1771
|
-
|
1745
|
+
28
|
1772
1746
|
I
|
1773
1747
|
3e
|
1774
1748
|
I
|
1775
|
-
|
1749
|
+
40
|
1776
1750
|
I
|
1777
1751
|
40
|
1778
1752
|
I
|
1779
|
-
|
1753
|
+
4b
|
1780
1754
|
I
|
1781
1755
|
42
|
1782
1756
|
I
|
1783
|
-
|
1757
|
+
55
|
1784
1758
|
I
|
1785
1759
|
43
|
1786
1760
|
I
|
1787
|
-
|
1761
|
+
75
|
1788
1762
|
I
|
1789
1763
|
46
|
1790
1764
|
I
|
1791
|
-
|
1765
|
+
8d
|
1792
1766
|
I
|
1793
1767
|
48
|
1794
1768
|
I
|
1795
|
-
|
1769
|
+
9a
|
1796
1770
|
x
|
1797
1771
|
61
|
1798
1772
|
/Users/ben/code/rack-client/lib/rack/client/adapter/simple.rb
|
1799
1773
|
p
|
1800
|
-
|
1774
|
+
8
|
1801
1775
|
x
|
1802
1776
|
3
|
1803
1777
|
url
|
@@ -1814,9 +1788,6 @@ x
|
|
1814
1788
|
5
|
1815
1789
|
block
|
1816
1790
|
x
|
1817
|
-
15
|
1818
|
-
query_or_params
|
1819
|
-
x
|
1820
1791
|
10
|
1821
1792
|
query_hash
|
1822
1793
|
x
|
@@ -1836,7 +1807,7 @@ x
|
|
1836
1807
|
9
|
1837
1808
|
build_env
|
1838
1809
|
i
|
1839
|
-
|
1810
|
+
89
|
1840
1811
|
23
|
1841
1812
|
2
|
1842
1813
|
10
|
@@ -1885,12 +1856,34 @@ i
|
|
1885
1856
|
19
|
1886
1857
|
4
|
1887
1858
|
15
|
1859
|
+
44
|
1860
|
+
43
|
1861
|
+
0
|
1862
|
+
79
|
1863
|
+
49
|
1864
|
+
1
|
1865
|
+
1
|
1866
|
+
13
|
1867
|
+
7
|
1868
|
+
8
|
1869
|
+
64
|
1870
|
+
5
|
1871
|
+
20
|
1872
|
+
4
|
1873
|
+
47
|
1874
|
+
49
|
1875
|
+
9
|
1876
|
+
1
|
1877
|
+
49
|
1878
|
+
10
|
1879
|
+
2
|
1880
|
+
15
|
1888
1881
|
20
|
1889
1882
|
0
|
1890
1883
|
20
|
1891
1884
|
4
|
1892
1885
|
49
|
1893
|
-
|
1886
|
+
11
|
1894
1887
|
0
|
1895
1888
|
20
|
1896
1889
|
2
|
@@ -1898,11 +1891,14 @@ i
|
|
1898
1891
|
3
|
1899
1892
|
54
|
1900
1893
|
52
|
1901
|
-
|
1894
|
+
12
|
1902
1895
|
4
|
1896
|
+
49
|
1897
|
+
13
|
1898
|
+
1
|
1903
1899
|
11
|
1904
1900
|
I
|
1905
|
-
|
1901
|
+
b
|
1906
1902
|
I
|
1907
1903
|
5
|
1908
1904
|
I
|
@@ -1911,7 +1907,7 @@ I
|
|
1911
1907
|
4
|
1912
1908
|
n
|
1913
1909
|
p
|
1914
|
-
|
1910
|
+
14
|
1915
1911
|
x
|
1916
1912
|
4
|
1917
1913
|
Hash
|
@@ -1934,12 +1930,24 @@ parse
|
|
1934
1930
|
x
|
1935
1931
|
1
|
1936
1932
|
+
|
1933
|
+
s
|
1934
|
+
9
|
1935
|
+
HTTP_HOST
|
1936
|
+
x
|
1937
|
+
13
|
1938
|
+
http_host_for
|
1939
|
+
x
|
1940
|
+
3
|
1941
|
+
[]=
|
1937
1942
|
x
|
1938
1943
|
4
|
1939
1944
|
to_s
|
1940
1945
|
x
|
1941
1946
|
9
|
1942
1947
|
build_env
|
1948
|
+
x
|
1949
|
+
5
|
1950
|
+
merge
|
1943
1951
|
p
|
1944
1952
|
7
|
1945
1953
|
I
|
@@ -1955,7 +1963,7 @@ I
|
|
1955
1963
|
I
|
1956
1964
|
4d
|
1957
1965
|
I
|
1958
|
-
|
1966
|
+
59
|
1959
1967
|
x
|
1960
1968
|
61
|
1961
1969
|
/Users/ben/code/rack-client/lib/rack/client/adapter/simple.rb
|
@@ -1976,8 +1984,126 @@ body
|
|
1976
1984
|
x
|
1977
1985
|
3
|
1978
1986
|
uri
|
1987
|
+
x
|
1988
|
+
13
|
1989
|
+
http_host_for
|
1990
|
+
M
|
1991
|
+
1
|
1992
|
+
n
|
1993
|
+
n
|
1994
|
+
x
|
1995
|
+
13
|
1996
|
+
http_host_for
|
1997
|
+
i
|
1998
|
+
49
|
1999
|
+
20
|
2000
|
+
0
|
2001
|
+
49
|
2002
|
+
0
|
2003
|
+
0
|
2004
|
+
7
|
2005
|
+
1
|
2006
|
+
20
|
2007
|
+
0
|
2008
|
+
49
|
2009
|
+
2
|
2010
|
+
0
|
2011
|
+
47
|
2012
|
+
49
|
2013
|
+
0
|
2014
|
+
0
|
2015
|
+
63
|
2016
|
+
2
|
2017
|
+
49
|
2018
|
+
3
|
2019
|
+
1
|
2020
|
+
9
|
2021
|
+
43
|
2022
|
+
20
|
2023
|
+
0
|
2024
|
+
49
|
2025
|
+
4
|
2026
|
+
0
|
2027
|
+
20
|
2028
|
+
0
|
2029
|
+
49
|
2030
|
+
2
|
2031
|
+
0
|
2032
|
+
35
|
2033
|
+
2
|
2034
|
+
7
|
2035
|
+
1
|
2036
|
+
64
|
2037
|
+
49
|
2038
|
+
5
|
2039
|
+
1
|
2040
|
+
8
|
2041
|
+
48
|
2042
|
+
20
|
2043
|
+
0
|
2044
|
+
49
|
2045
|
+
4
|
2046
|
+
0
|
2047
|
+
11
|
2048
|
+
I
|
2049
|
+
4
|
2050
|
+
I
|
2051
|
+
1
|
2052
|
+
I
|
2053
|
+
1
|
2054
|
+
I
|
2055
|
+
1
|
2056
|
+
n
|
2057
|
+
p
|
2058
|
+
6
|
2059
|
+
x
|
2060
|
+
4
|
2061
|
+
to_s
|
2062
|
+
s
|
2063
|
+
1
|
2064
|
+
:
|
2065
|
+
x
|
2066
|
+
4
|
2067
|
+
port
|
2068
|
+
x
|
2069
|
+
8
|
2070
|
+
include?
|
2071
|
+
x
|
2072
|
+
4
|
2073
|
+
host
|
2074
|
+
x
|
2075
|
+
4
|
2076
|
+
join
|
2077
|
+
p
|
2078
|
+
9
|
2079
|
+
I
|
2080
|
+
0
|
2081
|
+
I
|
2082
|
+
50
|
2083
|
+
I
|
2084
|
+
0
|
2085
|
+
I
|
2086
|
+
51
|
2087
|
+
I
|
2088
|
+
17
|
2089
|
+
I
|
2090
|
+
52
|
2091
|
+
I
|
2092
|
+
2b
|
2093
|
+
I
|
2094
|
+
54
|
2095
|
+
I
|
2096
|
+
31
|
2097
|
+
x
|
2098
|
+
61
|
2099
|
+
/Users/ben/code/rack-client/lib/rack/client/adapter/simple.rb
|
2100
|
+
p
|
2101
|
+
1
|
2102
|
+
x
|
2103
|
+
3
|
2104
|
+
uri
|
1979
2105
|
p
|
1980
|
-
|
2106
|
+
17
|
1981
2107
|
I
|
1982
2108
|
2
|
1983
2109
|
I
|
@@ -2001,13 +2127,17 @@ I
|
|
2001
2127
|
I
|
2002
2128
|
60
|
2003
2129
|
I
|
2004
|
-
|
2130
|
+
3d
|
2005
2131
|
I
|
2006
2132
|
6e
|
2007
2133
|
I
|
2008
2134
|
4b
|
2009
2135
|
I
|
2010
2136
|
7c
|
2137
|
+
I
|
2138
|
+
50
|
2139
|
+
I
|
2140
|
+
8a
|
2011
2141
|
x
|
2012
2142
|
61
|
2013
2143
|
/Users/ben/code/rack-client/lib/rack/client/adapter/simple.rb
|
@@ -48,7 +48,7 @@ module Rack
|
|
48
48
|
when 'PUT' then Net::HTTP::Put
|
49
49
|
end
|
50
50
|
|
51
|
-
klass.new(request.
|
51
|
+
klass.new(request.fullpath, Headers.from(request.env).to_http)
|
52
52
|
end
|
53
53
|
|
54
54
|
def body_for(request)
|
@@ -72,7 +72,7 @@ module Rack
|
|
72
72
|
def parse_headers(net_response)
|
73
73
|
headers = Headers.new
|
74
74
|
|
75
|
-
net_response.each do |
|
75
|
+
net_response.each do |k,v|
|
76
76
|
headers.update(k => v)
|
77
77
|
end
|
78
78
|
|
@@ -45,17 +45,25 @@ module Rack
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def process(rack_request)
|
48
|
-
::Typhoeus::Request.run((rack_request
|
48
|
+
::Typhoeus::Request.run((url_for(rack_request)).to_s, params_for(rack_request))
|
49
|
+
end
|
50
|
+
|
51
|
+
def url_for(rack_request)
|
52
|
+
rack_request.url.split('?').first
|
49
53
|
end
|
50
54
|
|
51
55
|
def params_for(rack_request)
|
52
56
|
{
|
53
57
|
:method => rack_request.request_method.downcase.to_sym,
|
54
58
|
:headers => Headers.from(rack_request.env).to_http,
|
55
|
-
:params =>
|
59
|
+
:params => query_params_for(rack_request)
|
56
60
|
}.merge(body_params_for(rack_request))
|
57
61
|
end
|
58
62
|
|
63
|
+
def query_params_for(rack_request)
|
64
|
+
Rack::Utils.parse_nested_query(rack_request.query_string)
|
65
|
+
end
|
66
|
+
|
59
67
|
def body_params_for(rack_request)
|
60
68
|
unless %w[ HEAD GET ].include? rack_request.request_method
|
61
69
|
{:body => rack_request.body.string}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Rack
|
2
2
|
module Client
|
3
3
|
class BodyCollection
|
4
|
-
instance_methods.each { |m| undef_method m unless m =~ /^__/ }
|
4
|
+
instance_methods.each { |m| undef_method m unless (m =~ /^__/ || m =~ /^object_id$/ ) }
|
5
5
|
|
6
6
|
def initialize(&load_with_proc)
|
7
7
|
raise ArgumentException, 'BodyCollection must be initialized with a block' unless block_given?
|
@@ -318,7 +318,7 @@ x
|
|
318
318
|
14
|
319
319
|
BodyCollection
|
320
320
|
i
|
321
|
-
|
321
|
+
67
|
322
322
|
57
|
323
323
|
19
|
324
324
|
0
|
@@ -346,17 +346,44 @@ i
|
|
346
346
|
49
|
347
347
|
4
|
348
348
|
1
|
349
|
+
13
|
350
|
+
10
|
351
|
+
54
|
352
|
+
15
|
353
|
+
20
|
354
|
+
0
|
355
|
+
7
|
356
|
+
5
|
357
|
+
13
|
358
|
+
70
|
349
359
|
9
|
350
|
-
|
360
|
+
51
|
361
|
+
15
|
362
|
+
44
|
363
|
+
43
|
364
|
+
1
|
365
|
+
7
|
366
|
+
6
|
367
|
+
78
|
368
|
+
49
|
369
|
+
3
|
370
|
+
2
|
371
|
+
6
|
372
|
+
5
|
373
|
+
49
|
374
|
+
4
|
375
|
+
1
|
376
|
+
9
|
377
|
+
59
|
351
378
|
1
|
352
379
|
8
|
353
|
-
|
380
|
+
66
|
354
381
|
5
|
355
382
|
20
|
356
383
|
0
|
357
384
|
47
|
358
385
|
49
|
359
|
-
|
386
|
+
7
|
360
387
|
1
|
361
388
|
11
|
362
389
|
I
|
@@ -369,7 +396,7 @@ I
|
|
369
396
|
1
|
370
397
|
n
|
371
398
|
p
|
372
|
-
|
399
|
+
8
|
373
400
|
n
|
374
401
|
x
|
375
402
|
6
|
@@ -383,6 +410,10 @@ new
|
|
383
410
|
x
|
384
411
|
2
|
385
412
|
=~
|
413
|
+
n
|
414
|
+
s
|
415
|
+
11
|
416
|
+
^object_id$
|
386
417
|
x
|
387
418
|
12
|
388
419
|
undef_method
|
@@ -393,7 +424,7 @@ I
|
|
393
424
|
I
|
394
425
|
4
|
395
426
|
I
|
396
|
-
|
427
|
+
43
|
397
428
|
x
|
398
429
|
69
|
399
430
|
/Users/ben/code/rack-client/lib/rack/client/parser/body_collection.rb
|
data/lib/rack/client/version.rb
CHANGED