songkick-transport 1.9.1 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/songkick/transport/request.rb +12 -1
- data/spec/songkick/transport/request_spec.rb +16 -0
- metadata +43 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd1492f22e6d92c333c9020af25be71d79ed1e74
|
4
|
+
data.tar.gz: 735d399c0e155a6fe504c66c553b862e1ed7b3f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbc9a6317cf7da6da37d6273be86dc23ea8974b5589b833414fe186028b4cccb4f4cb29ef70ab605f00ed20c57b6351efb1be7b00ad10dafe1eb9960c223685b
|
7
|
+
data.tar.gz: e1ca03fc8ee17b8b547785d802488597beca3af8afe4c0d9a0c7847455cb44f428b268501cfab0f3ec43127bf6450a05ea53ab103aa0dd3d366521d13d334924
|
@@ -68,6 +68,7 @@ module Songkick
|
|
68
68
|
Serialization.build_url(@verb, @endpoint, @path, @params)
|
69
69
|
end
|
70
70
|
|
71
|
+
TRUNCATED_PARAM_LENGTH = 500
|
71
72
|
def to_s
|
72
73
|
url = String === @endpoint ?
|
73
74
|
Serialization.build_url(@verb, @endpoint, @path, @params, true) :
|
@@ -79,7 +80,17 @@ module Songkick
|
|
79
80
|
command << " -H '#{key}: #{value}'"
|
80
81
|
end
|
81
82
|
return command unless use_body?
|
82
|
-
|
83
|
+
sanitized_params = Serialization.build_query_string(params, false, true)
|
84
|
+
sanitized_params = sanitized_params.inject({}) do |result, param|
|
85
|
+
key, value = param
|
86
|
+
if value.length > TRUNCATED_PARAM_LENGTH
|
87
|
+
result[key] = "#{value[0...TRUNCATED_PARAM_LENGTH]}[TRUNCATED]"
|
88
|
+
else
|
89
|
+
result[key] = value
|
90
|
+
end
|
91
|
+
result
|
92
|
+
end
|
93
|
+
query = sanitized_params.map { |p| p.join('=') }.join('&')
|
83
94
|
command << " -d '#{query}'"
|
84
95
|
command
|
85
96
|
end
|
@@ -59,6 +59,22 @@ describe Songkick::Transport::Request do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
describe "with a long post body" do
|
64
|
+
let :params do
|
65
|
+
{
|
66
|
+
:username => "a" * 5000,
|
67
|
+
:foo => "bar",
|
68
|
+
:access => {:token => "b" * 5000}
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
it "truncates the long parameter values" do
|
73
|
+
pattern = %r{^POST 'www.example.com/' -H 'Content-Type: application/x-www-form-urlencoded' -d '([^']+)'$}
|
74
|
+
expect(post_request.to_s).to match(pattern)
|
75
|
+
expect(query(post_request, pattern)).to eq(["access[token]=#{"b" * 500}[TRUNCATED]", "foo=bar", "username=#{"a" * 500}[TRUNCATED]"])
|
76
|
+
end
|
77
|
+
end
|
62
78
|
end
|
63
79
|
end
|
64
80
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: songkick-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Lucraft
|
@@ -14,146 +14,146 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: multipart-post
|
21
21
|
requirement: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
|
-
- -
|
23
|
+
- - '>='
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
version: 1.1.0
|
26
26
|
type: :runtime
|
27
27
|
prerelease: false
|
28
28
|
version_requirements: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.1.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: yajl-ruby
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - '>='
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 1.1.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 1.1.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activesupport
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 3.0.0
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - '>='
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 3.0.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: curb
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 0.3.0
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.3.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: httparty
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - '>='
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: 0.8.0
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - '>='
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 0.8.0
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rack-test
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - '>='
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: 0.4.0
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 0.4.0
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rake
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - '>='
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: rspec
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- -
|
121
|
+
- - '>='
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- -
|
128
|
+
- - '>='
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: sinatra
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
135
|
+
- - '>='
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
|
-
- -
|
142
|
+
- - '>='
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: thin
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
|
-
- -
|
149
|
+
- - '>='
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
|
-
- -
|
156
|
+
- - '>='
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
description: HTTP client abstraction for service clients
|
@@ -164,60 +164,59 @@ extra_rdoc_files:
|
|
164
164
|
- README.rdoc
|
165
165
|
files:
|
166
166
|
- README.rdoc
|
167
|
+
- examples/tcp_server.rb
|
167
168
|
- examples/example.rb
|
169
|
+
- examples/thread_safety.rb
|
168
170
|
- examples/loop.rb
|
169
171
|
- examples/server.rb
|
170
|
-
-
|
171
|
-
-
|
172
|
-
- lib/songkick/transport.rb
|
173
|
-
- lib/songkick/transport/authentication.rb
|
174
|
-
- lib/songkick/transport/base.rb
|
175
|
-
- lib/songkick/transport/curb.rb
|
172
|
+
- lib/songkick/transport/reporting.rb
|
173
|
+
- lib/songkick/transport/rack_test.rb
|
176
174
|
- lib/songkick/transport/headers.rb
|
177
|
-
- lib/songkick/transport/
|
175
|
+
- lib/songkick/transport/response.rb
|
176
|
+
- lib/songkick/transport/curb.rb
|
178
177
|
- lib/songkick/transport/http_error.rb
|
179
178
|
- lib/songkick/transport/httparty.rb
|
180
|
-
- lib/songkick/transport/
|
181
|
-
- lib/songkick/transport/reporting.rb
|
179
|
+
- lib/songkick/transport/service.rb
|
182
180
|
- lib/songkick/transport/request.rb
|
183
|
-
- lib/songkick/transport/
|
181
|
+
- lib/songkick/transport/authentication.rb
|
184
182
|
- lib/songkick/transport/serialization.rb
|
185
|
-
- lib/songkick/transport/service.rb
|
186
183
|
- lib/songkick/transport/upstream_error.rb
|
187
|
-
-
|
188
|
-
-
|
184
|
+
- lib/songkick/transport/base.rb
|
185
|
+
- lib/songkick/transport.rb
|
186
|
+
- spec/spec_helper.rb
|
187
|
+
- spec/songkick/transport_spec.rb
|
189
188
|
- spec/songkick/transport/curb_spec.rb
|
190
|
-
- spec/songkick/transport/
|
189
|
+
- spec/songkick/transport/service_spec.rb
|
191
190
|
- spec/songkick/transport/request_spec.rb
|
191
|
+
- spec/songkick/transport/authentication_spec.rb
|
192
|
+
- spec/songkick/transport/httparty_spec.rb
|
193
|
+
- spec/songkick/transport/base_spec.rb
|
192
194
|
- spec/songkick/transport/response_spec.rb
|
193
|
-
-
|
194
|
-
- spec/songkick/transport_spec.rb
|
195
|
-
- spec/spec_helper.rb
|
195
|
+
- lib/songkick/transport/html_report.html.erb
|
196
196
|
homepage: http://github.com/songkick/transport
|
197
197
|
licenses:
|
198
198
|
- MIT
|
199
199
|
metadata: {}
|
200
200
|
post_install_message:
|
201
201
|
rdoc_options:
|
202
|
-
-
|
202
|
+
- --main
|
203
203
|
- README.rdoc
|
204
204
|
require_paths:
|
205
205
|
- lib
|
206
206
|
required_ruby_version: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
|
-
- -
|
208
|
+
- - '>='
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: 1.8.7
|
211
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- -
|
213
|
+
- - '>='
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
217
|
rubyforge_project:
|
218
|
-
rubygems_version: 2.
|
218
|
+
rubygems_version: 2.1.11
|
219
219
|
signing_key:
|
220
220
|
specification_version: 4
|
221
221
|
summary: HTTP client abstraction for service clients
|
222
222
|
test_files: []
|
223
|
-
has_rdoc:
|