{"id":49534,"library":"trae","title":"trae","description":"Minimalistic HTTP client for the browser, based on the Fetch API. It provides a clean, promise-based interface for making HTTP requests (GET, POST, PUT, PATCH, DELETE, HEAD) with support for query parameters, custom headers, body type parsing (json, text, blob, etc.), mode and credentials configuration, and middleware. Current stable version is 1.4.2. It is designed to be future-proof with native Fetch, but requires a polyfill for older browsers. Lightweight alternative to axios with no external dependencies.","status":"active","version":"1.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/huemul/trae","tags":["javascript","fetch","http","request","api"],"install":[{"cmd":"npm install trae","lang":"bash","label":"npm"},{"cmd":"yarn add trae","lang":"bash","label":"yarn"},{"cmd":"pnpm add trae","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default import; named export does not exist.","wrong":"import { trae } from 'trae'","symbol":"default","correct":"import trae from 'trae'"},{"note":"create is a named export, but trae is the default. CommonJS destructure works too.","wrong":"const { create } = require('trae')","symbol":"create","correct":"import trae, { create } from 'trae'"},{"note":"GET requests do not accept a body parameter; use config.params instead.","wrong":"trae.get(url, body)","symbol":"trae.get","correct":"trae.get(url, config)"}],"quickstart":{"code":"import trae from 'trae';\n\n// GET request\nconst url = 'https://api.example.com/data';\ntrae.get(url, {\n  params: { key: process.env.API_KEY ?? '' }\n})\n  .then(response => {\n    console.log(response.data);\n  })\n  .catch(err => {\n    console.error(err);\n  });\n\n// POST request\nconst body = { title: 'foo', content: 'bar' };\ntrae.post('https://api.example.com/posts', body)\n  .then(() => console.log('Success'))\n  .catch(err => console.error(err));","lang":"javascript","description":"Demonstrates basic GET and POST requests using trae with promises."},"warnings":[{"fix":"Use response.data instead of response.body for parsed response body.","message":"v1.0.0 changed response structure: response.data instead of response.body","severity":"breaking","affected_versions":">=0.x <1.0.0"},{"fix":"Remove bodyType or set to undefined if you want raw response.","message":"bodyType: 'raw' is deprecated since v1.2.0; use bodyType: undefined or omit to get raw response","severity":"deprecated","affected_versions":">=1.2.0"},{"fix":"Use a fetch polyfill (e.g., 'whatwg-fetch') for Node.js or older browsers.","message":"Browser-only: trae relies on global fetch which is not available in Node.js <18 or older browsers","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.4.2':55 'altern':75 'api':12,86 'axio':77 'base':8,19 'blob':43 'bodi':38 'browser':7,73 'clean':16 'client':4 'configur':48 'credenti':47 'current':51 'custom':36 'delet':29 'depend':81 'design':58 'etc':44 'extern':80 'fetch':11,66,83 'futur':62 'future-proof':61 'get':25 'head':30 'header':37 'http':3,23,84 'interfac':20 'javascript':82 'json':41 'lightweight':74 'make':22 'middlewar':50 'minimalist':2 'mode':45 'nativ':65 'older':72 'paramet':35 'pars':40 'patch':28 'polyfil':70 'post':26 'promis':18 'promise-bas':17 'proof':63 'provid':14 'put':27 'queri':34 'request':24,85 'requir':68 'stabl':52 'support':32 'text':42 'trae':1 'type':39 'version':53","created_at":"2026-06-07T17:02:15.633923+00:00","updated_at":"2026-06-07T17:02:15.633923+00:00","problems":[{"fix":"Ensure the first argument to HTTP method is a valid URL string.","cause":"Using trae.get or similar without passing url as string, e.g., passing undefined or object.","error":"TypeError: Cannot read property 'then' of undefined"},{"fix":"Set config.mode to 'cors' or ensure server supports CORS. Also check for HTTPS vs HTTP mismatch.","cause":"CORS issue or network error when making cross-origin request without proper configuration.","error":"Uncaught TypeError: Failed to fetch"},{"fix":"Use trae.get or import trae correctly: import trae from 'trae'","cause":"Trying to call trae as a function instead of using trae.get etc., or incorrectly importing.","error":"TypeError: trae 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/huemul/trae#readme","github":"https://github.com/huemul/trae","docs":null,"changelog":null,"pypi":null,"npm":"trae","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-07","next_check":"2026-09-05","install_tag":null}}