MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / handleMessage

Method handleMessage

controller/mcp/iml.go:268–281  ·  view source on GitHub ↗
(ctx *gin.Context, server http.Handler)

Source from the content-addressed store, hash-verified

266}
267
268func (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
283type SessionInfo struct {
284 Apikey string

Callers 3

AppHandleMessageMethod · 0.95
GlobalHandleMessageMethod · 0.95
ServiceHandleMessageMethod · 0.95

Calls 3

GetMethod · 0.65
StringMethod · 0.45
ServeHTTPMethod · 0.45

Tested by

no test coverage detected