Skip to content

Commit

Permalink
add request support
Browse files Browse the repository at this point in the history
  • Loading branch information
sskim committed Sep 8, 2017
1 parent a82194f commit 53a0ce1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/fluent/plugin/in_http_pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,25 @@ def initialize
config_param :header, :string
end

config_section :request_header, param_name: :request_headers, multi: true do
desc 'The name of request header'
config_param :header, :string

desc 'The value of request header'
config_param :value, :string
end

def configure(conf)
compat_parameters_convert(conf, :parser)
super

@parser = parser_create unless @status_only
@_request_headers = @request_headers.map do |section|
header = section["header"]
value = section["value"]

[header.to_sym, value]
end.to_h
end

def start
Expand All @@ -72,6 +86,7 @@ def on_timer
request_options[:proxy] = @proxy if @proxy
request_options[:user] = @user if @user
request_options[:password] = @password if @password
request_options[:headers] = @_request_headers unless @request_headers.empty?

res = RestClient::Request.execute request_options

Expand Down

0 comments on commit 53a0ce1

Please sign in to comment.