MCPcopy Create free account
hub / github.com/github/gh-aw / parseRequestShape

Function parseRequestShape

pkg/workflow/engine_config_parser.go:171–193  ·  view source on GitHub ↗

parseRequestShape converts a raw request config map (from engine.provider.request) into a RequestShape.

(requestObj map[string]any)

Source from the content-addressed store, hash-verified

169// parseRequestShape converts a raw request config map (from engine.provider.request) into
170// a RequestShape.
171func parseRequestShape(requestObj map[string]any) *RequestShape {
172 shape := &RequestShape{}
173 if s, ok := requestObj["path-template"].(string); ok {
174 shape.PathTemplate = s
175 }
176 if q, ok := requestObj["query"].(map[string]any); ok {
177 shape.Query = make(map[string]string, len(q))
178 for k, v := range q {
179 if vs, ok := v.(string); ok {
180 shape.Query[k] = vs
181 }
182 }
183 }
184 if b, ok := requestObj["body-inject"].(map[string]any); ok {
185 shape.BodyInject = make(map[string]string, len(b))
186 for k, v := range b {
187 if vs, ok := v.(string); ok {
188 shape.BodyInject[k] = vs
189 }
190 }
191 }
192 return shape
193}
194
195// parseEngineTokenWeights converts a raw token-weights config value (from engine.token-weights)
196// into a types.TokenWeights. Returns nil when the input is not a usable map or contains

Callers 2

ExtractEngineConfigMethod · 0.85
TestParseRequestShapeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseRequestShapeFunction · 0.68