CELLibrary produces options that expose this matcher for use in CEL expression matchers. Example: expression header({'content-type': 'image/png'}) expression header({'foo': ['bar', 'baz']}) // match bar or baz
(_ caddy.Context)
| 1006 | // expression header({'content-type': 'image/png'}) |
| 1007 | // expression header({'foo': ['bar', 'baz']}) // match bar or baz |
| 1008 | func (MatchHeader) CELLibrary(_ caddy.Context) (cel.Library, error) { |
| 1009 | return CELMatcherImpl( |
| 1010 | "header", |
| 1011 | "header_matcher_request_map", |
| 1012 | []*cel.Type{CELTypeJSON}, |
| 1013 | func(data ref.Val) (RequestMatcherWithError, error) { |
| 1014 | mapStrListStr, err := CELValueToMapStrList(data) |
| 1015 | if err != nil { |
| 1016 | return nil, err |
| 1017 | } |
| 1018 | return MatchHeader(http.Header(mapStrListStr)), nil |
| 1019 | }, |
| 1020 | ) |
| 1021 | } |
| 1022 | |
| 1023 | // getHeaderFieldVals returns the field values for the given fieldName from input. |
| 1024 | // The host parameter should be obtained from the http.Request.Host field, and the |
nothing calls this directly
no test coverage detected