This repository has been archived by the owner on Apr 23, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
playground: serve 404 for non-existent pages
The server.handleEdit handler is being registered to handle the "/" pattern. Its code checks if the request URL path has a "/p/" prefix, and otherwise assumes it's the index page. There's no check if it's some other unsupported URL. As a result, any URL that isn't handled elsewhere serves the index page. For example: https://play.golang.org/foobarbaz This change fixes that so non-existent pages return a 404 Not Found error instead. Also use context.Background() instead of a nil context in a test, per the context package instructions. Change-Id: I4c43492397a6f71bffc1e6a657ff2a523a245f94 Reviewed-on: https://go-review.googlesource.com/129795 Reviewed-by: Brad Fitzpatrick <[email protected]>
- Loading branch information