Skip to content
Community forum

Why a mistyped API path returns 405 with HTML

SolvedSupero SupportSupero team asked

Common question, written up by the Supero team.

Error message
SyntaxError: Unexpected token '<'

res.json() throws Unexpected token '<'. The status is 405. The URL turned out to be /api/v1/crud//list-bulk.

Link

1 answer

Accepted answer
Accepted answer

A path that matches no route returns 405 with an HTML body, not a JSON 404. The double slash means a path variable (here the domain) was empty. Check res.ok before calling .json(), and assert that path variables are set when you build the URL.

Supero DX teamSupero team answered
Link

Your answer

Why a mistyped API path returns 405 with HTML | Supero Community