MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / String

Method String

runtime/pattern.go:238–264  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

236func (p Pattern) Verb() string { return p.verb }
237
238func (p Pattern) String() string {
239 var stack []string
240 for _, op := range p.ops {
241 switch op.code {
242 case utilities.OpNop:
243 continue
244 case utilities.OpPush:
245 stack = append(stack, "*")
246 case utilities.OpLitPush:
247 stack = append(stack, p.pool[op.operand])
248 case utilities.OpPushM:
249 stack = append(stack, "**")
250 case utilities.OpConcatN:
251 n := op.operand
252 l := len(stack) - n
253 stack = append(stack[:l], strings.Join(stack[l:], "/"))
254 case utilities.OpCapture:
255 n := len(stack) - 1
256 stack[n] = fmt.Sprintf("{%s=%s}", p.vars[op.operand], stack[n])
257 }
258 }
259 segs := strings.Join(stack, "/")
260 if p.verb != "" {
261 return fmt.Sprintf("/%s:%s", segs, p.verb)
262 }
263 return "/" + segs
264}
265
266/*
267 * The following code is adopted and modified from Go's standard library

Callers 15

TestMuxServeHTTPFunction · 0.95
TestPatternStringFunction · 0.95
StringValueFunction · 0.45
parseMessageFunction · 0.45
TestJSONPbEncoderFunction · 0.45
TestJSONPbEncoderFieldsFunction · 0.45
WithHealthEndpointAtFunction · 0.45
StringPFunction · 0.45

Calls

no outgoing calls

Tested by 11

TestMuxServeHTTPFunction · 0.76
TestPatternStringFunction · 0.76
TestJSONPbEncoderFunction · 0.36
TestJSONPbEncoderFieldsFunction · 0.36
TestPopulateParametersFunction · 0.36
TestJSONBuiltinEncoderFunction · 0.36