Sha256: d6853b509f92a8fbeb50bd98045ea61b87d1e7042ac28efd5926bedda28b9e96

Contents?: true

Size: 487 Bytes

Versions: 2

Compression:

Stored size: 487 Bytes

Contents

# encoding: utf-8

module HTTPkit
  class Server::BodyHandler
    def respond(request, response)
      response = response.with_headers(response.body_headers)

      yield request, banana_response(request, response)
    end

    private

    def banana_response(request, response)
      if !response.body_included? || head?(request)
        response.with_body('')
      else
        response
      end
    end

    def head?(request)
      request.http_method == :head
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
httpkit-0.6.0 lib/httpkit/server/body_handler.rb
httpkit-0.6.0.pre.5 lib/httpkit/server/body_handler.rb