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.

testinghttp-networking
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.

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.

{ "helpers": { "HTTP" : { "require": "codeceptjs-http", "endpoint": "http://localhost:8080" } } }

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.sendRequest('/users', 'POST', { json: { name: 'Alice' } });

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.

I.seeHttpResponseHasValidJsonSchema('userSchema.json');

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 footguns
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.
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.
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.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources