From 6ab6ea7018a9db2f9e7268bc0abb70b10179c47a Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Wed, 23 Nov 2016 11:15:02 +0900 Subject: [PATCH] Make sure `status` is an integer when set --- app/models/agents/website_agent.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/agents/website_agent.rb b/app/models/agents/website_agent.rb index f0eed11213..cc75bfb05a 100644 --- a/app/models/agents/website_agent.rb +++ b/app/models/agents/website_agent.rb @@ -130,7 +130,7 @@ class WebsiteAgent < Agent * `_response_`: A response object with the following keys: - * `status`: HTTP status as integer. (Almost always 200) When parsing `data_from_event`, this is set to the value of the `status` key in the incoming Event. + * `status`: HTTP status as integer. (Almost always 200) When parsing `data_from_event`, this is set to the value of the `status` key in the incoming Event, if it is a number or a string convertible to an integer. * `headers`: Response headers; for example, `{{ _response_.headers.Content-Type }}` expands to the value of the Content-Type header. Keys are insensitive to cases and -/_. When parsing `data_from_event`, this is constructed from the value of the `headers` key in the incoming Event, if it is a hash. @@ -624,7 +624,7 @@ def headers # Integer value of HTTP status def status - @object.payload[:status] + Integer(@object.payload[:status]) rescue nil end # The URL