Trust REST is a REST API testing library for Node.js (v2.1.0) that simplifies integration testing of RESTful services with a declarative API. Released under the MIT license, it provides a fluent interface for making HTTP requests and asserting responses, including support for JSON, headers, status codes, and body validation. Compared to alternatives like supertest, trust-rest focuses on lightweight syntax and minimal configuration. The library is stable with infrequent releases, primarily driven by bug fixes and minor feature additions. It supports both CommonJS and ES module systems, but users must ensure proper require/import usage to avoid runtime errors.
npm install trust-restNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic GET and POST requests with status and header assertions using trust-rest.
Use default import: import trust from 'trust-rest'
Assign result to variable and avoid calling .end() again
Upgrade Node.js to version 10 or later
Always pass base URL: trust('http://example.com')Use correct import: import trust from 'trust-rest' or const trust = require('trust-rest')Store response in variable and use that variable