parseRequestShape converts a raw request config map (from engine.provider.request) into a RequestShape.
(requestObj map[string]any)
| 169 | // parseRequestShape converts a raw request config map (from engine.provider.request) into |
| 170 | // a RequestShape. |
| 171 | func 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 |
no outgoing calls