mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 17:28:31 +02:00
fix(rules): add nil guard to entrypoint retrieval in route command
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -233,6 +234,9 @@ var commands = map[string]struct {
|
||||
route := args.(string)
|
||||
return func(w *httputils.ResponseModifier, req *http.Request, upstream http.HandlerFunc) error {
|
||||
ep := entrypoint.FromCtx(req.Context())
|
||||
if ep == nil {
|
||||
return errors.New("entrypoint not found")
|
||||
}
|
||||
r, ok := ep.HTTPRoutes().Get(route)
|
||||
if !ok {
|
||||
excluded, has := ep.ExcludedRoutes().Get(route)
|
||||
|
||||
Reference in New Issue
Block a user