{"id":40612,"library":"ava-http","title":"AVA-http","description":"AVA-http is a lightweight async HTTP request wrapper built on top of Request-Promise, designed originally for AVA test runners but usable anywhere. Version 1.0.0 targets Node >=4 with ESM support. It provides simplified GET, POST, PUT, DELETE methods that return only the response body on success, with companion *Response variants that always return the full response object. Compared to raw request-promise, it reduces boilerplate by defaulting to JSON parsing and providing a cleaner API for quick HTTP assertions.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/lukeed/ava-http","tags":["javascript","test","runner","ava","fast","assert","request","assertion","promise"],"install":[{"cmd":"npm install ava-http","lang":"bash","label":"npm"},{"cmd":"yarn add ava-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add ava-http","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core HTTP request functionality delegated to request-promise","package":"request-promise","optional":false}],"imports":[{"note":"Default export is an object with methods. Named import will not work.","wrong":"import { http } from 'ava-http'","symbol":"http","correct":"import http from 'ava-http'"},{"note":"For CommonJS, destructure from default export. ESM default import works, but named import may fail if package does not export named members.","wrong":"import { getResponse } from 'ava-http'","symbol":"getResponse","correct":"const { getResponse } = require('ava-http')"}],"quickstart":{"code":"import test from 'ava';\nimport http from 'ava-http';\n\nconst url = 'https://jsonplaceholder.typicode.com/posts/1';\n\ntest('async get request', async t => {\n  const body = await http.get(url);\n  t.truthy(body);\n  t.true(typeof body === 'object');\n  t.is(body.id, 1);\n});\n\ntest('post with JSON body', async t => {\n  const options = {\n    body: { userId: 1, title: 'foo' },\n    json: true\n  };\n  const payload = await http.post(url.replace('/1', ''), options);\n  t.truthy(payload.id);\n});","lang":"typescript","description":"Demonstrates basic GET and POST requests using ava-http inside an AVA test file."},"warnings":[{"fix":"Wrap calls in try/catch and inspect response properties (statusCode, body) on failure.","message":"Error responses return the full Response object, not the body. Always use .catch() or try/catch to handle non-2xx status codes.","severity":"gotcha","affected_versions":"*"},{"fix":"Use the *Response variants: http.getResponse, http.postResponse, etc.","message":"If you need the full Response object on success (e.g., to check statusCode), use http.getResponse instead of http.get.","severity":"gotcha","affected_versions":"*"},{"fix":"Switch to got or node-fetch with equivalent APIs.","message":"Request-Promise (underlying library) has been deprecated; consider migrating to a modern HTTP client like got or undici.","severity":"deprecated","affected_versions":"*"},{"fix":"Either use `form` and let the library set headers, or set headers manually and omit `form`.","message":"The `form` option automatically sets content-type header; do not set it manually or you may get duplicate headers.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'1.0.0':31 '4':34 'alway':59 'anywher':29 'api':83 'assert':87,93,95 'async':10 'ava':2,5,24,91 'ava-http':1,4 'bodi':51 'boilerpl':73 'built':14 'cleaner':82 'companion':55 'compar':65 'default':75 'delet':44 'design':21 'esm':36 'fast':92 'full':62 'get':41 'http':3,6,11,86 'javascript':88 'json':77 'lightweight':9 'method':45 'node':33 'object':64 'origin':22 'pars':78 'post':42 'promis':20,70,96 'provid':39,80 'put':43 'quick':85 'raw':67 'reduc':72 'request':12,19,69,94 'request-promis':18,68 'respons':50,56,63 'return':47,60 'runner':26,90 'simplifi':40 'success':53 'support':37 'target':32 'test':25,89 'top':16 'usabl':28 'variant':57 'version':30 'wrapper':13","created_at":"2026-06-04T18:48:25.577945+00:00","updated_at":"2026-06-04T18:48:25.577945+00:00","problems":[{"fix":"Run `npm install --save-dev ava-http` (or `--save` for production) and ensure node_modules is correct.","cause":"Package not installed or installed as devDependency but used in production.","error":"Cannot find module 'ava-http'"},{"fix":"Use `import http from 'ava-http'` not `import { http } from 'ava-http'`.","cause":"Named import instead of default import.","error":"TypeError: http.get is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/lukeed/ava-http#readme","github":"https://github.com/lukeed/ava-http","docs":null,"changelog":null,"pypi":null,"npm":"ava-http","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}