{"id":17190,"library":"codeceptjs-http","title":"CodeceptJS HTTP Helper","description":"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.","status":"abandoned","version":"0.0.7","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/testphony/codeceptjs-http","tags":["javascript","codeceptJS","codeceptjs","HTTP","API"],"install":[{"cmd":"npm install codeceptjs-http","lang":"bash","label":"npm"},{"cmd":"yarn add codeceptjs-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add codeceptjs-http","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the underlying HTTP request capabilities.","package":"then-request","optional":false},{"reason":"Used internally for assertions, a common JavaScript assertion library.","package":"chai","optional":false},{"reason":"Enables JSON schema validation for HTTP responses.","package":"chai-json-schema","optional":false}],"imports":[{"note":"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.","wrong":"import { HTTP } from 'codeceptjs-http';","symbol":"HTTP Helper Configuration","correct":"{\n  \"helpers\": {\n    \"HTTP\" : {\n      \"require\": \"codeceptjs-http\",\n      \"endpoint\": \"http://localhost:8080\"\n    }\n  }\n}"},{"note":"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.","wrong":"import { sendRequest } from 'codeceptjs-http'; sendRequest(...);","symbol":"I.sendRequest","correct":"I.sendRequest('/users', 'POST', { json: { name: 'Alice' } });"},{"note":"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.","wrong":"import { seeHttpResponseHasValidJsonSchema } from 'codeceptjs-http';","symbol":"I.seeHttpResponseHasValidJsonSchema","correct":"I.seeHttpResponseHasValidJsonSchema('userSchema.json');"}],"quickstart":{"code":"const { I } = inject();\n\nFeature('API Tests');\n\nBeforeSuite(() => {\n  // Assume a server is running on http://localhost:3000\n});\n\nScenario('Verify user creation and retrieve by ID', async () => {\n  const userData = { name: 'John Doe', email: 'john.doe@example.com' };\n  const createResponse = await I.sendRequest('/users', 'POST', {\n    headers: { 'Content-Type': 'application/json' },\n    json: userData\n  });\n\n  // Assuming the API returns the created user with an ID\n  const createdUser = createResponse.body;\n  I.expect(createResponse.statusCode).to.eql(201);\n  I.expect(createdUser).to.have.property('id');\n  I.seeHttpResponseHasValidJsonSchema('schemas/userCreateResponse.json', null, createdUser);\n\n  const userId = createdUser.id;\n  const getResponse = await I.sendRequest(`/users/${userId}`, 'GET');\n\n  I.expect(getResponse.statusCode).to.eql(200);\n  I.expect(getResponse.body.name).to.eql(userData.name);\n  I.seeHttpResponseHasValidJsonSchema('schemas/userGetResponse.json', null, getResponse.body);\n});\n\n// Minimal codecept.conf.js for this quickstart:\n// {\n//    \"helpers\": {\n//      \"HTTP\" : {\n//        \"require\": \"codeceptjs-http\",\n//        \"endpoint\": \"http://localhost:3000\"\n//      },\n//      \"ChaiWrapper\": {\n//         \"require\": \"codeceptjs-chai\"\n//      }\n//    }\n// }","lang":"javascript","description":"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."},"warnings":[{"fix":"Consider migrating to actively maintained CodeceptJS HTTP helpers or direct usage of `axios` or `node-fetch` within CodeceptJS custom helpers.","message":"This 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.","severity":"breaking","affected_versions":">=0.0.7"},{"fix":"Ensure the helper is properly configured in your `codecept.conf.js` file, and then call methods directly on `I` (e.g., `I.sendRequest(...)`).","message":"Functionality 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.","severity":"gotcha","affected_versions":">=0.0.1"},{"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).","message":"JSON 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.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"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.","cause":"The `HTTP` helper has not been correctly configured or enabled in the CodeceptJS configuration file (`codecept.conf.js` or `codecept.json`).","error":"TypeError: I.sendRequest is not a function"},{"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`.","cause":"The package's primary dependency, `then-request`, or other peer dependencies were not installed correctly.","error":"Error: Cannot find module 'then-request'"},{"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.","cause":"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.","error":"Error: ENOENT: no such file or directory, open '.../schemas/yourSchema.json'"}],"ecosystem":"npm","meta_description":null}