skipper: github.com/zalando/skipper/filters/serve Index | Files

package serve

import "github.com/zalando/skipper/filters/serve"

Package serve provides a wrapper of net/http.Handler to be used as a filter.

Index

Package Files

serve.go

func ServeHTTP Uses

func ServeHTTP(ctx filters.FilterContext, h http.Handler)

Creates a response from a handler and a request.

It calls the handler's ServeHTTP method with an internal response writer that shares the status code, headers and the response body with the returned response. It blocks until the handler calls the response writer's WriteHeader, or starts writing the body, or returns. The written body is not buffered, but piped to the returned response's body.

Example, a simple file server:

var handler = http.StripPrefix(webRoot, http.FileServer(http.Dir(root)))

func (f *myFilter) Request(ctx filters.FilterContext) {
	serve.ServeHTTP(ctx, handler)
}

Package serve imports 3 packages (graph) and is imported by 11 packages. Updated 2019-04-10. Refresh now. Tools for package owners.