[Test] Add malformed request and unsupported method tests for API routes

Open
#1,380 3 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@Komelove is already working on this.

Since Nov 20, 2026.

  • #1481 by @Komelove — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
api, testing

Research direction

Start by reading route logic in packages/api-core/src, the Vercel entry points under api/v1, and the local server at apps/api-local/src/index.ts; check issue #1333 for the planned shared error envelope. Map the public routes and their existing tests, then compare malformed input and unsupported method behavior across both server paths. Done means the cases assert the shared error envelope and pnpm lint and pnpm typecheck pass.

Written by the indexing model from the issue text.

Description

api medium Stellar Wave testing

Summary

The API route tests cover the happy path and selected validation failures, but not malformed JSON, a missing content type, or an unsupported HTTP method. These cases can produce an uncaught exception or a platform default response.

Motivation

A public API should fail predictably for bad input. A stable client error is easier to debug than a platform 500, and a method test catches a handler that accidentally accepts a write through the wrong verb.

Proposed Solution

Add a table-driven test suite for each public route covering malformed JSON, an empty body, a missing or wrong content type, an unsupported method, and a valid request. Assert the status and the shared error envelope. Apply the same cases to the local Fastify server where the behavior can differ.

Scope

Field Value
Area Testing
Protocol affected None
Network testnet and mainnet
Breaking change? No

Alternatives Considered

Testing only through the web client leaves the raw route behavior unverified. A single smoke test per route does not cover the input boundary.

Acceptance Criteria

  • Every public route has malformed input and unsupported method tests
  • Invalid input returns a stable client error, not an uncaught exception
  • The local server behavior matches the Vercel handlers
  • Tests use the shared error envelope
  • pnpm lint and pnpm typecheck pass

Additional Context

Route logic is in packages/api-core/src and the Vercel entry points are under api/v1. The local server is apps/api-local/src/index.ts. The error envelope is planned in #1333.

Dominant language
TypeScript
Stars
17
Forks
129
Avg merge
3d 13h
Merged PRs (30d)
54

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from drydocs/meridian

All issues in drydocs/meridian

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.