(ctx *gin.Context, server http.Handler)
| 266 | } |
| 267 | |
| 268 | func (i *imlMcpController) handleMessage(ctx *gin.Context, server http.Handler) { |
| 269 | sessionId := ctx.Request.URL.Query().Get("sessionId") |
| 270 | params, ok := i.sessionKeys.Load(sessionId) |
| 271 | if !ok { |
| 272 | ctx.String(403, "sessionId not found") |
| 273 | return |
| 274 | } |
| 275 | ps, ok := params.(SessionInfo) |
| 276 | cfg := i.settingModule.Get(ctx) |
| 277 | req := ctx.Request.WithContext(utils.SetGatewayInvoke(ctx.Request.Context(), cfg.InvokeAddress)) |
| 278 | req = req.WithContext(utils.SetLabel(req.Context(), "apikey", ps.Apikey)) |
| 279 | req = req.WithContext(utils.SetLabel(req.Context(), "app", ps.App)) |
| 280 | server.ServeHTTP(ctx.Writer, req) |
| 281 | } |
| 282 | |
| 283 | type SessionInfo struct { |
| 284 | Apikey string |
no test coverage detected