{"id":18875,"library":"typescript-http-client","title":"TypeScript HTTP Client","description":"A lightweight Promise-based HTTP client for TypeScript with a filter chain architecture, version 0.10.5. Released infrequently (last update 2020). Differentiates from axios/fetch by offering a middleware-like filter system for request/response transformation, caching, or logging. Ships TypeScript types. Supports typed responses via generics. Not actively maintained; consider alternatives like ky or axios for modern apps.","status":"maintenance","version":"0.10.5","language":"javascript","source_language":"en","source_url":"https://github.com/taktik/typescript-http-client","tags":["javascript","typescript"],"install":[{"cmd":"npm install typescript-http-client","lang":"bash","label":"npm"},{"cmd":"yarn add typescript-http-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add typescript-http-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Named export, not default.","wrong":"import newHttpClient from 'typescript-http-client'","symbol":"newHttpClient","correct":"import { newHttpClient } from 'typescript-http-client'"},{"note":"ESM-only; can also use CJS destructure but prefer named imports.","wrong":"const Request = require('typescript-http-client').Request","symbol":"Request","correct":"import { Request } from 'typescript-http-client'"},{"note":"Used for type annotations; no common alternative import.","wrong":null,"symbol":"Response","correct":"import { Response } from 'typescript-http-client'"},{"note":"Interface for custom filters.","wrong":null,"symbol":"Filter","correct":"import { Filter } from 'typescript-http-client'"},{"note":"Used in filter implementation.","wrong":null,"symbol":"FilterChain","correct":"import { FilterChain } from 'typescript-http-client'"}],"quickstart":{"code":"import { Request, newHttpClient } from 'typescript-http-client';\n\nconst client = newHttpClient();\nconst request = new Request('https://jsonplaceholder.typicode.com/todos/1', { responseType: 'text' });\nclient.execute<string>(request).then(response => {\n  console.log(response);\n}).catch(err => {\n  console.error(err);\n});","lang":"typescript","description":"Creates an HTTP client, builds a GET request, and executes it with typed text response."},"warnings":[{"fix":"Ensure each filter's doFilter method awaits or returns filterChain.doFilter(call).","message":"Filter chain: Filters must call filterChain.doFilter() or the request hangs.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use newHttpClient() instead of newClient().","message":"Version 0.10.x renamed newClient() to newHttpClient().","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Consider migrating to a maintained alternative like ky or axios.","message":"Package not updated since 2020; may have unpatched security issues.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Explicitly set { responseType: 'text' } for non-JSON responses.","message":"The Request constructor's responseType defaults to 'json'; set to 'text' for string responses.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use newHttpClient() to create the client instance.","cause":"Old API: newClient() was renamed to newHttpClient() in v0.10.","error":"TypeError: client.execute is not a function"},{"fix":"Add 'const response = await filterChain.doFilter(call); return response;' in each filter.","cause":"A filter's doFilter did not invoke filterChain.doFilter() causing infinite wait.","error":"Error: Filter must call filterChain.doFilter"},{"fix":"Ensure generic parameter matches expected response body type.","cause":"Misunderstanding of Response type: body property exists but may be typed incorrectly.","error":"Property 'body' does not exist on type 'Response<U>'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}