Skip to content

Commit 002943a

Browse files
committed
fix: fix incorrect response when calling '/' path route handlers
1 parent e7c8dfd commit 002943a

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

pkg/run/gateway.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@ func (s *BaseHttpGateway) api(ctx *fasthttp.RequestCtx) {
5555
// Rewrite the URL of the request to remove the /api/{name} subroute
5656
pathParts := nitric_utils.SplitPath(string(ctx.Path()))
5757

58-
// When a request is made to the base API path, return status info
59-
if len(pathParts) == 2 {
60-
w := s.pool.GetWorkers(&worker.GetWorkerOptions{
61-
Filter: apiWorkerFilter(apiName),
62-
})
63-
ctx.Response.SetBody([]byte(fmt.Sprintf("<html><body><strong>%d</strong> active route(s) detected for API %v.</body></html>", len(w), apiName)))
64-
if len(w) > 0 {
65-
ctx.Response.SetStatusCode(200)
66-
} else {
67-
ctx.Response.SetStatusCode(404)
68-
}
69-
return
70-
}
71-
7258
// remove first two path parts
7359
newPathParts := pathParts[2:]
7460

@@ -85,7 +71,7 @@ func (s *BaseHttpGateway) api(ctx *fasthttp.RequestCtx) {
8571
})
8672

8773
if err != nil {
88-
ctx.Error("worker not found for api", 404)
74+
ctx.Error("No workers found for provided API route", 404)
8975
return
9076
}
9177

0 commit comments

Comments
 (0)