INNER CODE UNIT · Go

func

zalando/skipper · doc.go:297

	func (s *helloSpec) Name() string { return "hello" }

	func (s *helloSpec) CreateFilter(config []interface{}) (filters.Filter, error) {
	    if len(config) == 0 {
	        return nil, filters.ErrInvalidFilterParameters
	    }

	    if who, ok := config[0].(string); ok {
	        return &helloFilter{who}, nil
	    } else {
	        return nil, filters.ErrInvalidFilterParameters
	    }
	}

	func (f *helloFilter) Request(ctx filters.FilterContext) {}

	func (f *helloFilter) Response(ctx filters.FilterContext) {
	    ctx.Response().Header.Set("X-Hello", fmt.Sprintf("Hello, %s!", f.who))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…