Skip to content

Handle unsupported methods on metadata endpoints#235

Open
samsamtrum wants to merge 1 commit into
etherspot:masterfrom
samsamtrum:fix-metadata-method-response
Open

Handle unsupported methods on metadata endpoints#235
samsamtrum wants to merge 1 commit into
etherspot:masterfrom
samsamtrum:fix-metadata-method-response

Conversation

@samsamtrum
Copy link
Copy Markdown

@samsamtrum samsamtrum commented May 24, 2026

Adds explicit non-GET handlers for the metadata endpoints.

Unsupported methods now return the existing unsupported-method response instead of falling through into request body parsing.

Checked with:

  • ./node_modules/.bin/eslint src/routes/metadata-routes.ts

I also tried npm run check:types, but this checkout currently fails in an existing test import: src/paymaster/index.test.ts expects PAYMASTER_ADDRESS from ../constants/Token.js.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

Walkthrough

This PR adds explicit HTTP method validation to three metadata API endpoints by registering fallback handlers for POST, PUT, PATCH, and DELETE requests. A new sendUnsupportedMetadataMethod function responds with BAD_REQUEST and UNSUPPORTED_METHOD error, applied consistently across /metadata, /metadata/v2, and /metadata/v3.

Changes

Metadata HTTP method handlers

Layer / File(s) Summary
Add fallback handlers for non-GET methods on metadata endpoints
backend/src/routes/metadata-routes.ts
Registers sendUnsupportedMetadataMethod handler for POST, PUT, PATCH, and DELETE on /metadata, /metadata/v2, and /metadata/v3 endpoints, responding with BAD_REQUEST and UNSUPPORTED_METHOD error.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit hops through metadata lanes,
Waving off POST with gentle disdain,
GET passes through, all others meet walls—
Three endpoints now guard their HTTP calls! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description lacks the structured template format required by the repository, missing key sections like 'Types of changes' and not explaining the context comprehensively. Reorganize the description to follow the template structure: add a 'Types of changes' section (appears to be a Bugfix), expand the 'Description' section with more context about the issue, and move validation notes to 'Further comments'.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding handlers for unsupported HTTP methods on metadata endpoints.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant