lib/sensu/api/http_handler.rb
def respond
        @response.status = @response_status || 200
        @response.status_string = @response_status_string || "OK"
        if @response_content && @http_request_method != HEAD_METHOD
          if @http_request_method == GET_METHOD && @filter_params
            filter_response_content!
          end
          @response.content_type "application/json"
          @response.content = Sensu::JSON.dump(@response_content)
        end
        @response.headers["Connection"] = "close"
        log_response
        @response.send_response
      end
# Respond to an HTTP request. The routes set `@response_status`,
# `@response_status_string`, and `@response_content`
# appropriately. The HTTP response status defaults to `200` with
# the status string `OK`. If filter params were provided,
# `@response_content` is filtered (mutated). The Sensu API only
# returns JSON response content, `@response_content` is assumed
# to be a Ruby object that can be serialized as JSON.
Respond to an HTTP request.
Respond to an HTTP request .
def respond
        @response.status = @response_status || 200
        @response.status_string = @response_status_string || "OK"
        if @response_content && @http_request_method != HEAD_METHOD
          if @http_request_method == GET_METHOD && @filter_params
            filter_response_content!
          end
          @response.content_type "application/json"
          @response.content = Sensu::JSON.dump(@response_content)
        end
        @response.headers["Connection"] = "close"
        log_response
        @response.send_response
      end
def respond @response . status = @response_status || 200 @response . status_string = @response_status_string || "OK" if @response_content && @http_request_method != HEAD_METHOD if @http_request_method == GET_METHOD && @filter_params filter_response_content! end @response . content_type "application/json" @response . content = Sensu :: JSON . dump ( @response_content ) end @response . headers [ "Connection" ] = "close" log_response @response . send_response end
Respond to an HTTP request.
Respond to an HTTP request .