class Azure::Core::Http::HttpFilter

A filter which can modify the HTTP pipeline both before and after requests/responses. Multiple filters can be nested in a “Russian Doll” model to create a compound HTTP pipeline

Public Class Methods

new(&block) click to toggle source

Initialize a HttpFilter

&block - An inline block which implements the filter.

The inline block should take parameters |request, _next| where request is a HttpRequest and _next is an object that implements a method .call which returns an HttpResponse. The block passed to the constructor should also return HttpResponse, either as the result of calling _next.call or by customized logic.

# File lib/azure/core/http/http_filter.rb, line 33
def initialize(&block)
  @block = block
end

Public Instance Methods

call(request, _next) click to toggle source

Executes the filter

request - HttpRequest. The request _next - An object that implements .call (no params)

NOTE: _next is a either a subsequent HttpFilter wrapped in a closure, or the HttpRequest object’s call method. Either way, it must have it’s .call method executed within each filter to

complete the pipeline. _next.call should return an HttpResponse

and so should this Filter.

# File lib/azure/core/http/http_filter.rb, line 47
def call(request, _next)
  @block ? @block.call(request, _next) : _next.call
end