Skip to content

Commit

Permalink
use unless and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Guba Sándor committed Sep 24, 2015
1 parent 6ab9de4 commit 4d10e53
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fluent/plugin/in_http.rb
Expand Up @@ -131,7 +131,7 @@ def on_request(path_info, params)
end
end

if not record.is_a?(Array)
unless record.is_a?(Array)
if @add_http_headers and
params.each_pair { |k,v|
if k.start_with?("HTTP_")
Expand Down
18 changes: 18 additions & 0 deletions test/plugin/test_in_http.rb
Expand Up @@ -85,6 +85,24 @@ def test_multi_json

end

def test_multi_json_with_add_http_headers
d = create_driver(CONFIG + "add_http_headers true")

time = Time.parse("2011-01-02 13:14:15 UTC").to_i
events = [{"a"=>1},{"a"=>2}]
tag = "tag1"

d.run do
res = post("/#{tag}", {"json"=>events.to_json, "time"=>time.to_s})
assert_equal "200", res.code
end

d.emit_streams.each { |tag, es|
print es
assert include_http_header?(es.first[1])
}
end

def test_json_with_add_http_headers
d = create_driver(CONFIG + "add_http_headers true")

Expand Down

0 comments on commit 4d10e53

Please sign in to comment.