ns-http-gotchas
Installation
SKILL.md
Http helpers are status-blind
Http.getJSON, getString, getFile, getImage reject only on transport failure or content-conversion failure. The HTTP status code is never consulted:
- A 500 that returns valid JSON (
{"error": "..."}) resolves successfully — your error payload becomes your data. - A 404 returning an HTML error page makes
getJSONreject with a JSON parse error — which reads like a client-side bug and sends you debugging the wrong layer.
The correct pattern: request + status check
import { Http } from '@nativescript/core';