Skip to content

Commit f6ecea0

Browse files
Merge pull request #12 from HatsuneMiku3939/fix/remove-contents-type-warning
remove content-type warning
2 parents fc0de2b + 9934c25 commit f6ecea0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

fluent-plugin-http-pull.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
33

44
Gem::Specification.new do |spec|
55
spec.name = "fluent-plugin-http-pull"
6-
spec.version = "0.6.0"
6+
spec.version = "0.6.1"
77
spec.authors = ["filepang"]
88
spec.email = ["[email protected]"]
99

lib/fluent/plugin/in_http_pull.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ def configure(conf)
7171
super
7272

7373
@parser = parser_create unless @status_only
74-
@_request_headers = @request_headers.map do |section|
74+
@_request_headers = {
75+
"Content-Type" => "application/x-www-form-urlencoded"
76+
}.merge(@request_headers.map do |section|
7577
header = section["header"]
7678
value = section["value"]
7779

7880
[header.to_sym, value]
79-
end.to_h
81+
end.to_h)
8082

8183
@http_method = :head if @status_only
8284
end
@@ -91,12 +93,11 @@ def on_timer
9193
record = { "url" => @url }
9294

9395
begin
94-
request_options = { method: @http_method, url: @url, timeout: @timeout }
96+
request_options = { method: @http_method, url: @url, timeout: @timeout, headers: @_request_headers }
9597

9698
request_options[:proxy] = @proxy if @proxy
9799
request_options[:user] = @user if @user
98100
request_options[:password] = @password if @password
99-
request_options[:headers] = @_request_headers unless @request_headers.empty?
100101

101102
res = RestClient::Request.execute request_options
102103

0 commit comments

Comments
 (0)