Resolved linitng issue
This commit is contained in:
@@ -76,7 +76,7 @@ func addMiddleware(ctx context.Context, mgr handler.PluginManager, handler http.
|
|||||||
|
|
||||||
func moduleCtxMiddleware(moduleName string, next http.Handler) http.Handler {
|
func moduleCtxMiddleware(moduleName string, next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := context.WithValue(r.Context(), model.ContextKeyModuleId, moduleName)
|
ctx := context.WithValue(r.Context(), model.ContextKeyModuleID, moduleName)
|
||||||
next.ServeHTTP(w, r.WithContext(ctx))
|
next.ServeHTTP(w, r.WithContext(ctx))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ func TestRegisterSuccess(t *testing.T) {
|
|||||||
// Create a handler that extracts context
|
// Create a handler that extracts context
|
||||||
var capturedModuleName any
|
var capturedModuleName any
|
||||||
testHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
testHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
capturedModuleName = r.Context().Value(model.ContextKeyModuleId)
|
capturedModuleName = r.Context().Value(model.ContextKeyModuleID)
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ type Subscriber struct {
|
|||||||
Domain string `json:"domain"`
|
Domain string `json:"domain"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContextKey string
|
|
||||||
|
|
||||||
const ContextKeyModuleId ContextKey = "module_id"
|
|
||||||
|
|
||||||
// Subscription represents subscription details of a network participant.
|
// Subscription represents subscription details of a network participant.
|
||||||
type Subscription struct {
|
type Subscription struct {
|
||||||
Subscriber `json:",inline"`
|
Subscriber `json:",inline"`
|
||||||
|
|||||||
Reference in New Issue
Block a user