MCPcopy Create free account
hub / github.com/goadesign/goa / cookies

Function cookies

dsl/http.go:1159–1186  ·  view source on GitHub ↗

cookies returns the mapped attribute containing the cookies for the given expression if it's either the root, a service or an endpoint - nil otherwise.

(exp eval.Expression)

Source from the content-addressed store, hash-verified

1157// cookies returns the mapped attribute containing the cookies for the given
1158// expression if it's either the root, a service or an endpoint - nil otherwise.
1159func cookies(exp eval.Expression) *expr.MappedAttributeExpr {
1160 switch e := exp.(type) {
1161 case *expr.RootExpr:
1162 if e.API.HTTP.Cookies == nil {
1163 e.API.HTTP.Cookies = expr.NewEmptyMappedAttributeExpr()
1164 }
1165 return e.API.HTTP.Cookies
1166 case *expr.HTTPServiceExpr:
1167 if e.Cookies == nil {
1168 e.Cookies = expr.NewEmptyMappedAttributeExpr()
1169 }
1170 return e.Cookies
1171 case *expr.HTTPEndpointExpr:
1172 if e.Cookies == nil {
1173 e.Cookies = expr.NewEmptyMappedAttributeExpr()
1174 }
1175 return e.Cookies
1176 case *expr.HTTPResponseExpr:
1177 if e.Cookies == nil {
1178 e.Cookies = expr.NewEmptyMappedAttributeExpr()
1179 }
1180 return e.Cookies
1181 case *expr.MappedAttributeExpr:
1182 return e
1183 default:
1184 return nil
1185 }
1186}
1187
1188// params returns the mapped attribute containing the path and query params for
1189// the given expression if it's either the root, an API server, a service or an

Callers 1

CookieFunction · 0.85

Calls 1

Tested by

no test coverage detected