mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-26 05:55:27 +00:00
Return a 404 if there is no repository (#141)
If no repository is found the user expects a 404 status code instead of a dependency failed status code (as it was before). Signed-off-by: Jan Klippel <c0d3b3rg@kl1pp3l.de> Fixes: https://codeberg.org/Codeberg/Community/issues/809 Co-authored-by: Jan Klippel <c0d3b3rg@kl1pp3l.de> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/141 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: jklippel <jklippel@noreply.codeberg.org> Co-committed-by: jklippel <jklippel@noreply.codeberg.org>
This commit is contained in:
parent
f2f943c0d8
commit
caeb1a4acb
@ -115,6 +115,6 @@ func handleSubDomain(log zerolog.Logger, ctx *context.Context, giteaClient *gite
|
|||||||
|
|
||||||
// Couldn't find a valid repo/branch
|
// Couldn't find a valid repo/branch
|
||||||
html.ReturnErrorPage(ctx,
|
html.ReturnErrorPage(ctx,
|
||||||
fmt.Sprintf("couldn't find a valid repo[%s]", targetRepo),
|
fmt.Sprintf("could not find a valid repository[%s]", targetRepo),
|
||||||
http.StatusFailedDependency)
|
http.StatusNotFound)
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ func TestHandlerPerformance(t *testing.T) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
testCase := func(uri string, status int) {
|
testCase := func(uri string, status int) {
|
||||||
|
t.Run(uri, func(t *testing.T) {
|
||||||
req := httptest.NewRequest("GET", uri, nil)
|
req := httptest.NewRequest("GET", uri, nil)
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
@ -39,10 +40,10 @@ func TestHandlerPerformance(t *testing.T) {
|
|||||||
} else {
|
} else {
|
||||||
t.Logf("request took %d milliseconds", end.Sub(start).Milliseconds())
|
t.Logf("request took %d milliseconds", end.Sub(start).Milliseconds())
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
testCase("https://mondstern.codeberg.page/", 424) // TODO: expect 200
|
testCase("https://mondstern.codeberg.page/", 404) // TODO: expect 200
|
||||||
testCase("https://mondstern.codeberg.page/", 424) // TODO: expect 200
|
testCase("https://codeberg.page/", 404) // TODO: expect 200
|
||||||
testCase("https://example.momar.xyz/", 424) // TODO: expect 200
|
testCase("https://example.momar.xyz/", 424)
|
||||||
testCase("https://codeberg.page/", 424) // TODO: expect 200
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user