params returns the mapped attribute containing the path and query params for the given expression if it's either the root, an API server, a service or an endpoint - nil otherwise.
(exp eval.Expression)
| 1189 | // the given expression if it's either the root, an API server, a service or an |
| 1190 | // endpoint - nil otherwise. |
| 1191 | func params(exp eval.Expression) *expr.MappedAttributeExpr { |
| 1192 | switch e := exp.(type) { |
| 1193 | case *expr.RootExpr: |
| 1194 | if e.API.HTTP.Params == nil { |
| 1195 | e.API.HTTP.Params = expr.NewEmptyMappedAttributeExpr() |
| 1196 | } |
| 1197 | return e.API.HTTP.Params |
| 1198 | case *expr.HTTPServiceExpr: |
| 1199 | if e.Params == nil { |
| 1200 | e.Params = expr.NewEmptyMappedAttributeExpr() |
| 1201 | } |
| 1202 | return e.Params |
| 1203 | case *expr.HTTPEndpointExpr: |
| 1204 | if e.Params == nil { |
| 1205 | e.Params = expr.NewEmptyMappedAttributeExpr() |
| 1206 | } |
| 1207 | return e.Params |
| 1208 | case *expr.MappedAttributeExpr: |
| 1209 | return e |
| 1210 | default: |
| 1211 | return nil |
| 1212 | } |
| 1213 | } |
| 1214 | |
| 1215 | // cookieAttribute initialize the current attribute metadata with the details of |
| 1216 | // a HTTP cookie attribute for use by the HTTP code generator. |
no test coverage detected