MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / AppHandleSSE

Method AppHandleSSE

controller/mcp/iml.go:54–76  ·  view source on GitHub ↗
(ctx *gin.Context)

Source from the content-addressed store, hash-verified

52}
53
54func (i *imlMcpController) AppHandleSSE(ctx *gin.Context) {
55 apikey := ctx.Request.URL.Query().Get("apikey")
56 appId := ctx.Param("app")
57 if appId == "" {
58 ctx.AbortWithStatusJSON(403, gin.H{"code": -1, "msg": "invalid app id", "success": "fail"})
59 return
60 }
61 ok, err := i.authorizationModule.CheckAPIKeyAuthorizationByApp(ctx, appId, apikey)
62 if err != nil {
63 ctx.AbortWithStatusJSON(403, gin.H{"code": -1, "msg": err.Error(), "success": "fail"})
64 return
65 }
66 if !ok {
67 ctx.AbortWithStatusJSON(403, gin.H{"code": -1, "msg": "invalid apikey", "success": "fail"})
68 return
69 }
70
71 ctx.Request.URL.Path = fmt.Sprintf("/openapi/v1/%s/sse", mcp_server.GlobalBasePath)
72 i.handleSSE(ctx, i.openSseServer, SessionInfo{
73 Apikey: apikey,
74 App: appId,
75 })
76}
77
78func (i *imlMcpController) AppHandleMessage(ctx *gin.Context) {
79 appId := ctx.Param("app")

Callers

nothing calls this directly

Calls 3

handleSSEMethod · 0.95
GetMethod · 0.65

Tested by

no test coverage detected