Skip to content

Commit

Permalink
http: do nothing for none content type respose
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 26, 2015
1 parent cf3543f commit 4a9a730
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/grntest/executors/http-executor.rb
Expand Up @@ -84,25 +84,25 @@ def send_load_command(command)
http.read_timeout = @read_timeout
http.request(request)
end
normalize_response_data(response.body)
normalize_response_data(command, response.body)
end

def send_normal_command(command)
url = "http://#{@host}:#{@port}#{command.to_uri_format}"
begin
open(url, :read_timeout => @read_timeout) do |response|
normalize_response_data(response.read)
normalize_response_data(command, response.read)
end
rescue OpenURI::HTTPError
$!.io.read
end
end

def normalize_response_data(raw_response_data)
if raw_response_data.empty?
def normalize_response_data(command, raw_response_data)
if raw_response_data.empty? or command.output_type == :none
raw_response_data
else
"#{raw_response_data.chomp}\n"
"#{raw_response_data}\n"
end
end
end
Expand Down

0 comments on commit 4a9a730

Please sign in to comment.