class Falcon::Adapters::Rewindable
Content-type driven input buffering, specific to the needs of ‘rack`.
def call(request)
@parameter request [Protocol::HTTP::Request]
Wrap the request body in a rewindable buffer if required.
def call(request) if body = request.body and needs_rewind?(request) request.body = Async::HTTP::Body::Rewindable.new(body) end return super end
def initialize(app)
Initialize the rewindable middleware.
def initialize(app) super(app) end
def needs_rewind?(request)
@parameter request [Protocol::HTTP::Request]
Determine whether the request needs a rewindable body.
def needs_rewind?(request) content_type = request.headers['content-type'] if request.method == POST and content_type.nil? return true end if BUFFERED_MEDIA_TYPES =~ content_type return true end return false end