MCPcopy
hub / github.com/Tencent/WeKnora / newDataSourceTestRouter

Function newDataSourceTestRouter

internal/handler/datasource_test.go:47–59  ·  view source on GitHub ↗
(h *DataSourceHandler)

Source from the content-addressed store, hash-verified

45}
46
47func newDataSourceTestRouter(h *DataSourceHandler) *gin.Engine {
48 gin.SetMode(gin.TestMode)
49 r := gin.New()
50 r.Use(errorCapture())
51 r.Use(func(c *gin.Context) {
52 if tenantID, ok := c.Request.Context().Value(types.TenantIDContextKey).(uint64); ok {
53 c.Set(types.TenantIDContextKey.String(), tenantID)
54 }
55 c.Next()
56 })
57 r.GET("/datasource/:id/logs", h.GetSyncLogs)
58 return r
59}
60
61func withDSCtx(req *http.Request, tenantID uint64) *http.Request {
62 ctx := req.Context()

Calls 5

errorCaptureFunction · 0.85
GETMethod · 0.80
SetMethod · 0.65
ValueMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected