Strelka::App::

Filters

module
Extended With
Strelka::Plugin

Request/response filters plugin for Strelka::App.

Public Instance Methods

anchor
apply_request_filters( request )

Apply :request and :both filters to request.

# File lib/strelka/app/filters.rb, line 78
def apply_request_filters( request )
        self.log.debug "Applying request filters:"
        self.class.request_filters.each do |filter|
                self.log.debug "  filter: %p" % [ filter ]
                filter.call( request )
        end
end
anchor
apply_response_filters( response )

Apply :both and :response filters to response.

# File lib/strelka/app/filters.rb, line 88
def apply_response_filters( response )
        self.log.debug "Applying response filters:"
        self.class.response_filters.each do |filter|
                self.log.debug "  filter: %p" % [ filter ]
                filter.call( response )
        end
end
anchor
handle_request( request )

Apply filters to the given request before yielding back to the App, then apply filters to the response that comes back.

# File lib/strelka/app/filters.rb, line 66
def handle_request( request )
        self.log.debug "[:filters] Wrapping request with request/response filters."

        self.apply_request_filters( request )
        response = super
        self.apply_response_filters( request.response )

        return response
end