ApplyToGin writes the response side-effects to a gin.Context. The gin-aware transport calls this once per request after a service method returns successfully. A nil receiver is a no-op (service methods that have no side-effects may return nil).
(gc *gin.Context, side *ResponseSideEffects)
| 100 | // successfully. A nil receiver is a no-op (service methods that have no |
| 101 | // side-effects may return nil). |
| 102 | func ApplyToGin(gc *gin.Context, side *ResponseSideEffects) { |
| 103 | if side == nil || gc == nil { |
| 104 | return |
| 105 | } |
| 106 | for _, c := range side.Cookies { |
| 107 | if c == nil { |
| 108 | continue |
| 109 | } |
| 110 | // gin.SetSameSite is per-call and must be set before SetCookie. |
| 111 | gc.SetSameSite(c.SameSite) |
| 112 | gc.SetCookie(c.Name, c.Value, c.MaxAge, c.Path, c.Domain, c.Secure, c.HttpOnly) |
| 113 | } |
| 114 | } |
no outgoing calls