MCPcopy
hub / github.com/caddyserver/caddy / CELLibrary

Method CELLibrary

modules/caddyhttp/matchers.go:817–831  ·  view source on GitHub ↗

CELLibrary produces options that expose this matcher for use in CEL expression matchers. Example: expression method('PUT', 'POST')

(_ caddy.Context)

Source from the content-addressed store, hash-verified

815//
816// expression method('PUT', 'POST')
817func (MatchMethod) CELLibrary(_ caddy.Context) (cel.Library, error) {
818 return CELMatcherImpl(
819 "method",
820 "method_request_list",
821 []*cel.Type{cel.ListType(cel.StringType)},
822 func(data ref.Val) (RequestMatcherWithError, error) {
823 refStringList := stringSliceType
824 strList, err := data.ConvertToNative(refStringList)
825 if err != nil {
826 return nil, err
827 }
828 return MatchMethod(strList.([]string)), nil
829 },
830 )
831}
832
833// CaddyModule returns the Caddy module information.
834func (MatchQuery) CaddyModule() caddy.ModuleInfo {

Callers

nothing calls this directly

Calls 3

CELMatcherImplFunction · 0.85
MatchMethodTypeAlias · 0.85
ConvertToNativeMethod · 0.45

Tested by

no test coverage detected