internal handlers: support for response modifiers
Co-authored-by: Julien Salleyron <julien@containo.us> Co-authored-by: Romain <rtribotte@users.noreply.github.com> Co-authored-by: Jean-Baptiste Doumenjou <jb.doumenjou@gmail.com>
This commit is contained in:
parent
b0f7b71453
commit
9f32292473
6 changed files with 109 additions and 13 deletions
|
@ -19,6 +19,7 @@ type Builder struct {
|
|||
}
|
||||
|
||||
// Build Builds the response modifier.
|
||||
// It returns nil if there is no modifier to apply.
|
||||
func (f *Builder) Build(ctx context.Context, names []string) func(*http.Response) error {
|
||||
var modifiers []func(*http.Response) error
|
||||
|
||||
|
@ -60,5 +61,5 @@ func (f *Builder) Build(ctx context.Context, names []string) func(*http.Response
|
|||
}
|
||||
}
|
||||
|
||||
return func(response *http.Response) error { return nil }
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -184,6 +184,9 @@ func TestBuilderBuild(t *testing.T) {
|
|||
builder := NewBuilder(rtConf.Middlewares)
|
||||
|
||||
rm := builder.Build(context.Background(), test.middlewares)
|
||||
if rm == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp := test.buildResponse(test.conf)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue