webcomponents / webcomponents.org

Home of the web components community
https://www.webcomponents.org
Apache License 2.0
356 stars 95 forks source link

[site-server] Add 404 response for bad element paths #1403

Closed justinfagnani closed 1 year ago

justinfagnani commented 1 year ago

The route pattern for elements is loose because it can have 2 or 3 segments. This tightens up validation in the handler.

It also adds a simple server test which will come in handy soon. I use to use supertest for server tests, but the fetch() API offers everything I used from it.

github-actions[bot] commented 1 year ago

A live preview of this PR will be available at the URL below and will update on each commit. = The build takes ~5-10 minutes, and will 404 until finished.

https://pr1403---site-khswqo4xea-wl.a.run.app/

Warning Until our Cloud Run project is public, only authorized users can view the above URL. The easiest way to view it authenticated is to run the following proxy command and visit http://localhost:5453

(gcloud beta run services proxy --project=webcomponents-org-test --region=us-west2 --tag=pr1403 --port=5453 site \
& gcloud beta run services proxy --project=webcomponents-org-test --region=us-west2 --tag=pr1403 --port=6453 catalog)