Registry / testing / rest-assured-ts

rest-assured-ts

JSON →
library0.1.8jsnpmunverified

Rest-Assured-TS (v0.1.8) is a TypeScript/JavaScript REST API test automation library inspired by Postman, RestAssured, and Karate. It supports Cucumber, Mocha, Jest, CommonJS, ES6, and TypeScript. Key differentiators include implicit Chai assertion support for JSON responses, file-based request/response handling, and JSON path validation. The library is actively maintained and aims to provide a low-code approach for REST API testing.

npm install rest-assured-ts
INSTALL
IMPORT
SIG · REST-ASSURED-TS
R
rest-assured-ts
testingjavascriptv0.1.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

restRequest
✓ import { restRequest } from 'rest-assured-ts'
✗ const restRequest = require('rest-assured-ts')
ESM-style import is recommended; CommonJS require still works but may not have TypeScript types.
default import
✓ import rest from 'rest-assured-ts'
✗ const rest = require('rest-assured-ts')
There is no default export; use named imports like restRequest or restRequestSync.
restRequestSync
✓ import { restRequestSync } from 'rest-assured-ts'
Synchronous version of restRequest for simple usage.

Demonstrates basic GET request using restRequest with headers and timeout.

import { restRequest } from 'rest-assured-ts'; async function testAPI() { const response = await restRequest('https://gorest.co.in/public-api/users', { headerOptions: { 'Content-Type': 'application/json' }, httpMethod: 'GET', timeOut: 10000, }); console.log(response.statusCode); // e.g., 200 console.log(response.body); // response JSON } testAPI();
Debug
Known issues
gotchaHeader names in headerOptions must be lowercase. The library does not normalize headers.
fix
Use lowercase header names: 'content-type' instead of 'Content-Type'.
affects: >=0.1.0
deprecatedrestRequestSync may be deprecated in future versions in favor of async/await.
fix
Use restRequest with async/await instead.
affects: >=0.1.5
breakingVersion 0.1.8 changed the default HTTP client from got to a custom implementation. Some proxy settings may break.
fix
Update proxy agent configuration per new docs; test existing proxy setups.
affects: >=0.1.8
gotchaInput body must be a string; passing a JavaScript object will cause errors.
fix
Always JSON.stringify object bodies before passing to restRequest.
affects: >=0.1.0
gotchaThe library does not validate schema automatically; response validation must be done via Chai or custom code.
fix
Write explicit assertions for response structure.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: Cannot read property 'statusCode' of undefined
restRequest returned undefined because the request timed out or threw an error that was not caught.
fix
Wrap the call in try/catch and handle errors. Check timeout and network connectivity.
Error: getaddrinfo ENOTFOUND example.com
DNS lookup failed for the API host.
fix
Verify the API URL. Check network connectivity and proxy configuration.
ChaiAssertionError: expected false to be true
Implicit Chai assertion failed due to mismatched JSON path or expected value.
fix
Check the JSON path expression and expected value in the test data.
Upgrade
Version history
0.1.8latest on npm
Audit
Dependencies
gotrequiredHTTP client used for making requests
chaioptionalAssertion library for response validation
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
rest-assured-ts — npm install rest-assured-ts · libregistry