Registry / testing / codeceptjs-http

codeceptjs-http

JSON →
library0.0.7jsnpmunverified

codeceptjs-http is an abandoned CodeceptJS helper that wraps the `then-request` library to facilitate making HTTP requests within CodeceptJS tests. It offers functionality to send requests and validate JSON responses against schemas. The package, currently at version 0.0.7, was last updated over six years ago and is not actively maintained, making it potentially incompatible with newer versions of Node.js or CodeceptJS. Its primary differentiation was providing a more flexible request management alternative to other HTTP helpers at the time, integrating directly into the CodeceptJS `I` object for test interactions.

npm install codeceptjs-http
INSTALL
IMPORT
SIG · CODECEPTJS-HTTP
C
codeceptjs-http
testingjavascriptv0.0.7
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

HTTP Helper Configuration
✓ { "helpers": { "HTTP" : { "require": "codeceptjs-http", "endpoint": "http://localhost:8080" } } }
✗ import { HTTP } from 'codeceptjs-http';
This package is a CodeceptJS helper. Its functionality is accessed via the `I` object in tests after configuration in `codecept.conf.js` or `codecept.json`, not via direct ES module imports.
I.sendRequest
✓ I.sendRequest('/users', 'POST', { json: { name: 'Alice' } });
✗ import { sendRequest } from 'codeceptjs-http'; sendRequest(...);
The `sendRequest` method is exposed on the global CodeceptJS `I` object after the `codeceptjs-http` helper is correctly configured. It is not directly imported from the package.
I.seeHttpResponseHasValidJsonSchema
✓ I.seeHttpResponseHasValidJsonSchema('userSchema.json');
✗ import { seeHttpResponseHasValidJsonSchema } from 'codeceptjs-http';
The `seeHttpResponseHasValidJsonSchema` method is available on the `I` object within CodeceptJS tests, provided the helper is configured. Schema files are loaded relative to a 'schemas' folder in the CodeceptJS root.

Demonstrates configuring the HTTP helper, sending a POST request to create a user, validating the response schema, then sending a GET request to retrieve the user.

const { I } = inject(); Feature('API Tests'); BeforeSuite(() => { // Assume a server is running on http://localhost:3000 }); Scenario('Verify user creation and retrieve by ID', async () => { const userData = { name: 'John Doe', email: 'john.doe@example.com' }; const createResponse = await I.sendRequest('/users', 'POST', { headers: { 'Content-Type': 'application/json' }, json: userData }); // Assuming the API returns the created user with an ID const createdUser = createResponse.body; I.expect(createResponse.statusCode).to.eql(201); I.expect(createdUser).to.have.property('id'); I.seeHttpResponseHasValidJsonSchema('schemas/userCreateResponse.json', null, createdUser); const userId = createdUser.id; const getResponse = await I.sendRequest(`/users/${userId}`, 'GET'); I.expect(getResponse.statusCode).to.eql(200); I.expect(getResponse.body.name).to.eql(userData.name); I.seeHttpResponseHasValidJsonSchema('schemas/userGetResponse.json', null, getResponse.body); }); // Minimal codecept.conf.js for this quickstart: // { // "helpers": { // "HTTP" : { // "require": "codeceptjs-http", // "endpoint": "http://localhost:3000" // }, // "ChaiWrapper": { // "require": "codeceptjs-chai" // } // } // }
Debug
Known issues
breakingThis package is abandoned and unmaintained. It was last updated over six years ago (v0.0.7) and is highly likely to be incompatible with modern Node.js versions (e.g., Node.js 16+), newer CodeceptJS releases, or other contemporary libraries. Expect installation failures, runtime errors, and security vulnerabilities due to outdated dependencies.
fix
Consider migrating to actively maintained CodeceptJS HTTP helpers or direct usage of `axios` or `node-fetch` within CodeceptJS custom helpers.
affects: >=0.0.7
gotchaFunctionality is accessed via the global CodeceptJS `I` object. Direct `import` or `require` statements for methods like `sendRequest` will not work and are incorrect for this helper type.
fix
Ensure the helper is properly configured in your `codecept.conf.js` file, and then call methods directly on `I` (e.g., `I.sendRequest(...)`).
affects: >=0.0.1
gotchaJSON schema files for `seeHttpResponseHasValidJsonSchema` are resolved relative to a 'schemas' folder located at the root of your CodeceptJS project (e.g., `path.join(global.codecept_dir, './schemas/')`). Misplacing schema files will result in 'file not found' errors.
fix
Organize your JSON schema files within a `schemas` directory at the base of your CodeceptJS project or provide absolute paths if necessary (though not recommended for portability).
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: I.sendRequest is not a function
The `HTTP` helper has not been correctly configured or enabled in the CodeceptJS configuration file (`codecept.conf.js` or `codecept.json`).
fix
Add the `HTTP` helper to your `codecept.conf.js` under the `helpers` section with `require: 'codeceptjs-http'` and ensure CodeceptJS is loading this configuration.
Error: Cannot find module 'then-request'
The package's primary dependency, `then-request`, or other peer dependencies were not installed correctly.
fix
Run `npm install codeceptjs-http` or ensure `then-request`, `chai`, and `chai-json-schema` are listed in your project's `package.json` and then run `npm install`.
Error: ENOENT: no such file or directory, open '.../schemas/yourSchema.json'
The specified JSON schema file for `I.seeHttpResponseHasValidJsonSchema` could not be found. The helper expects schemas to be in a `schemas` directory relative to the CodeceptJS project root.
fix
Create a `schemas` directory at your project root and place `yourSchema.json` inside it, or verify the path provided to `seeHttpResponseHasValidJsonSchema` is correct relative to this `schemas` folder.
Upgrade
Version history
0.0.7latest on npm
Audit
Dependencies
then-requestrequiredProvides the underlying HTTP request capabilities.
chairequiredUsed internally for assertions, a common JavaScript assertion library.
chai-json-schemarequiredEnables JSON schema validation for HTTP responses.
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
codeceptjs-http — npm install codeceptjs-http · libregistry