fix(http): analytics.flisk.si answers POST, PUT and DELETE on / with 200 and the full home page instead of 405
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
Research direction
Start in the Worker's fetch handler where the home route is registered for every method; compare it with the host.flisk.si Worker, which already returns 405 for POST. Reproduce first with curl -s -o /dev/null -w "%{http_code}\n" -X POST https://analytics.flisk.si/, then write the failing test for POST/PUT/DELETE on / expecting 405 plus an Allow: GET, HEAD header. Done means those three verbs return 405, GET and HEAD still return 200, the tracking endpoint that needs POST is untouched, and the existing test suite still passes.
Written by the indexing model from the issue text.
Description
Problem
https://analytics.flisk.si/ answers POST, PUT and DELETE with 200 and the full 13.8 KB home page, the same as a GET. A page route should only accept GET and HEAD and answer anything else with 405 Method Not Allowed and an Allow header. host.flisk.si already does this (POST returns 405).
Reproduce:
curl -s -o /dev/null -w "%{http_code}\n" -X POST https://analytics.flisk.si/prints 200- the same with
-X PUTand-X DELETEprints 200
Root Cause Analysis
The home route is registered for every HTTP method, so the Worker renders the page whatever the verb. Clients and scanners that probe with write verbs get a success status, which hides mistakes (a script posting to the wrong URL looks like it worked) and wastes a Worker run and 13 KB per request.
TDD Fix Plan
- RED: Add a test that POST / returns 405 with an
Allow: GET, HEADheader.
GREEN: Register the home route for GET only (HEAD is allowed by the router) and add a catch-all 405 for other verbs. - RED: Add a test that PUT and DELETE on / return 405.
GREEN: Cover them with the same handler. - RED: Add a test that GET and HEAD / still return 200.
GREEN: Keep the existing route working.
REFACTOR: Reuse the method guard on the other page routes.
Acceptance Criteria
- POST, PUT and DELETE on / return 405 with an Allow header
- GET and HEAD on / still return 200
- The tracking endpoint that needs POST is unchanged
- All new tests pass
- Existing tests still pass
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 2
- Avg merge
- 1h 33m
- Merged PRs (30d)
- 7
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from flisk-sh/analytics
-
agents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
agents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
agents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
agents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
agents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
All issues in flisk-sh/analytics
Similar issues
-
chore cloudflare-workers consistency d1 difficulty: easy documentation dx enhancement good first issue help wanted hygiene javascript maintenance priority: P3 seo
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Link Checker ReportOpenautomated issue report
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
MattiaPARRINELLO/backstage#70 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
untemps/svelte-palette#298 ·