Skip to content

Commit bb4d57a

Browse files
committed
fix: return after serveError
1 parent 3e993c1 commit bb4d57a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/engine.go

+2
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ func (e *Engine) handleRequest(ctx context.Context, pk *PianoKey) {
158158
matchedTree, ok := e.forest.get(pk.Request.Method)
159159
if !ok {
160160
e.serveError(ctx, pk, consts.StatusMethodNotAllowed, bytesconv.S2B(consts.BodyMethodNotAllowed))
161+
return
161162
}
162163
path := pk.Request.URL.Path
163164
validatePath(path)
@@ -166,6 +167,7 @@ func (e *Engine) handleRequest(ctx context.Context, pk *PianoKey) {
166167
matchedNode := matchedTree.search(path, params)
167168
if matchedNode == nil {
168169
e.serveError(ctx, pk, consts.StatusNotFound, bytesconv.S2B(consts.BodyNotFound))
170+
return
169171
}
170172
pk.SetHandlers(matchedNode.handlers)
171173
pk.Next(ctx)

0 commit comments

Comments
 (0)