huginn_http_request_agent 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/huginn_http_request_agent/http_request_agent.rb +12 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 653100f0a586c808cea718f38a8e55873b20666b
|
4
|
+
data.tar.gz: 610976e15c13270eaaea835188f0d93ecb6bbe29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a8d6736777a825a9115d54532866c45e6657b38ce90beae9a317556f6485ebac898b33ed3503c7003c87307801dc62db1be047dcd4d17eacad6c13986aaa549
|
7
|
+
data.tar.gz: e88736b87e88e5602b3a081e1745887d7e63cc0d5b3d0fea56e91242c37432480396acab0e8079e4694d24eb2af7ab6b8bfa6a6f7060e431e05d7cc6ae5affab
|
@@ -42,11 +42,18 @@ module Agents
|
|
42
42
|
|
43
43
|
- `json` to send JSON instead
|
44
44
|
- `xml` to send XML, where the name of the root element may be specified using `xml_root`
|
45
|
+
- All other `content_type`'s will be serialized as a string
|
45
46
|
|
46
47
|
By default, non-GETs will be sent with form encoding (`application/json`).
|
47
48
|
|
48
|
-
|
49
|
+
The `content_type` field will default the `Content-Type` header if it is not explicitly set in the following manner:
|
49
50
|
|
51
|
+
- if `Content-Type` is set use value
|
52
|
+
- else if `content_type==json` then `Content-Type=application/json`
|
53
|
+
- else if `content_type==xml` then `Content-Type=application/xml`
|
54
|
+
- else `Content-Type=content_type`
|
55
|
+
|
56
|
+
This allows you fine grained control over the mime type being used.
|
50
57
|
|
51
58
|
### Response
|
52
59
|
|
@@ -194,7 +201,7 @@ module Agents
|
|
194
201
|
|
195
202
|
case content_type
|
196
203
|
when 'json'
|
197
|
-
headers['Content-Type']
|
204
|
+
headers['Content-Type'] ||= 'application/json; charset=utf-8'
|
198
205
|
url = faraday.build_url(url, data.compact)
|
199
206
|
else
|
200
207
|
params = data
|
@@ -216,13 +223,13 @@ module Agents
|
|
216
223
|
|
217
224
|
case content_type
|
218
225
|
when 'json'
|
219
|
-
headers['Content-Type']
|
226
|
+
headers['Content-Type'] ||= 'application/json; charset=utf-8'
|
220
227
|
body = data.to_json
|
221
228
|
when 'xml'
|
222
|
-
headers['Content-Type']
|
229
|
+
headers['Content-Type'] ||= 'text/xml; charset=utf-8'
|
223
230
|
body = data.to_xml(root: (interpolated(event.payload)[:xml_root] || 'post'))
|
224
231
|
when MIME_RE
|
225
|
-
headers['Content-Type']
|
232
|
+
headers['Content-Type'] ||= content_type
|
226
233
|
body = data.to_s
|
227
234
|
else
|
228
235
|
body = data
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: huginn_http_request_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Spizziri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|