huginn_http_request_agent 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa4b89cbaf5fef82663f2845a176ff324843eb74
4
- data.tar.gz: 45bf7be76d8549e519571e0a4da22101e2167868
3
+ metadata.gz: 36b2f32f5ca8dff8c7207ef43e87c5701841851a
4
+ data.tar.gz: 5c5fd722e9fd7b3c3895ffae573a5d8387d57c85
5
5
  SHA512:
6
- metadata.gz: 4c8cbcb0ef880d72ac64ac14ce67a1b2f611976b9ee9eef7a09f0ad94a13667806cf4cd6a21692d0b551d1286ac777018d155300dc01e60f53400c5e0daec184
7
- data.tar.gz: bec6693f64867873839b1b22be72faf25dfe754f810b79958fd294bb494dfadd0bf008666e67387353eb22a31f24c17ae620e9a86ddb880903bf2e5e1f8158f1
6
+ metadata.gz: 480a1e17807919b31417ec9fd863ae6c81c016b4edd9939e7a2e31651e1152c54afa9f45a4976e53d093448818833b56ee1d8b80a91fd0c00f27345f92df35fe
7
+ data.tar.gz: 291f2a11465fffa00ca80c45c7193ac7e74cf5fa791e73cbef3095dfee9623361916509f816cc7a1e5545464d5bee71ce0aa46151aa1ddac7c96b667ce477176
@@ -34,6 +34,7 @@ module Agents
34
34
  - `no_merge` - Setting this value to `true` will result in the incoming event, but still send the interpolated payload
35
35
  - `output_mode` - Setting this value to `merge` will result in the emitted Event being merged into the original contents of the received Event. Setting it to `clean` will result in no merge.
36
36
  - `emit_events` - Setting this to `true` will result in the server response being emitted as an Event which can be subsequently consumed by another agent (ex. to a WebsiteAgent for parsing of the response body)
37
+ - `log_requests` - Setting this to `true` will log the contents of the interpolated request object sent by this event.
37
38
 
38
39
  ### Content Type's:
39
40
 
@@ -93,7 +94,8 @@ module Agents
93
94
  'headers' => {},
94
95
  'emit_events' => 'true',
95
96
  'no_merge' => 'false',
96
- 'output_mode' => 'clean'
97
+ 'output_mode' => 'clean',
98
+ 'log_requests' => 'false'
97
99
  }
98
100
  end
99
101
 
@@ -138,6 +140,10 @@ module Agents
138
140
  errors.add(:base, "if provided, emit_events must be true or false")
139
141
  end
140
142
 
143
+ if options.has_key?('log_requests') && boolify(options['log_requests']).nil?
144
+ errors.add(:base, "If provided, log_requests must be true or false")
145
+ end
146
+
141
147
  validate_event_headers_options!
142
148
 
143
149
  unless %w[post get put delete patch].include?(method)
@@ -163,6 +169,7 @@ module Agents
163
169
  incoming_events.each do |event|
164
170
  interpolate_with(event) do
165
171
  outgoing = interpolated['payload'].presence || {}
172
+
166
173
  if boolify(interpolated['no_merge'])
167
174
  handle outgoing, event, headers(interpolated[:headers])
168
175
  else
@@ -224,6 +231,10 @@ module Agents
224
231
  error "Invalid method '#{method}'"
225
232
  end
226
233
 
234
+ if boolify(interpolated['log_requests'])
235
+ log({ method: method, url: url, body: body, headers: headers })
236
+ end
237
+
227
238
  response = faraday.run_request(method.to_sym, url, body, headers) { |request|
228
239
 
229
240
  # open/read timeout in seconds
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.0.0
4
+ version: 1.1.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-10-02 00:00:00.000000000 Z
11
+ date: 2019-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler