{"id":15960,"library":"apollo-link-http-common","title":"Apollo Link HTTP Common Utilities","description":"apollo-link-http-common is an internal utility package within the deprecated `apollo-link` ecosystem, specifically designed to provide shared HTTP functionalities for other Apollo Link packages like `apollo-link-http` and `apollo-link-http-batch`. It extracts common logic for handling HTTP requests and responses, but it is not intended for direct consumption by end-user applications. The package, currently at version 0.2.16, explicitly warns that its API is unstable and versions may not adhere to SemVer, reflecting its role as a rapidly evolving internal component. Since Apollo Client 3.0, the entire `apollo-link` library, including this common utilities package, has been largely deprecated. Its core functionalities have been integrated directly into `@apollo/client/link/http`, making direct use of `apollo-link-http-common` obsolete and actively discouraged. Developers should migrate to the equivalent utilities provided by `@apollo/client` for stable HTTP networking.","status":"deprecated","version":"0.2.16","language":"javascript","source_language":"en","source_url":"https://github.com/apollographql/apollo-link","tags":["javascript","apollo","http","network","typescript"],"install":[{"cmd":"npm install apollo-link-http-common","lang":"bash","label":"npm"},{"cmd":"yarn add apollo-link-http-common","lang":"bash","label":"yarn"},{"cmd":"pnpm add apollo-link-http-common","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for GraphQL type definitions and utilities.","package":"graphql","optional":false}],"imports":[{"note":"This package is not intended for direct end-user consumption. Use ESM-style imports if absolutely necessary for internal development, but migration to @apollo/client is recommended.","wrong":"const { selectHttpOptionsAndBody } = require('apollo-link-http-common');","symbol":"selectHttpOptionsAndBody","correct":"import { selectHttpOptionsAndBody } from 'apollo-link-http-common'"},{"note":"This is a named export, not a default. The package is generally deprecated, and these utilities are now found within @apollo/client.","wrong":"import parseAndCheckHttpResponse from 'apollo-link-http-common';","symbol":"parseAndCheckHttpResponse","correct":"import { parseAndCheckHttpResponse } from 'apollo-link-http-common'"},{"note":"Primarily for internal use by other `apollo-link` packages. Direct use is discouraged due to the package's deprecated status and unstable API.","wrong":"const serializeFetchParameter = require('apollo-link-http-common').serializeFetchParameter;","symbol":"serializeFetchParameter","correct":"import { serializeFetchParameter } from 'apollo-link-http-common'"}],"quickstart":{"code":"import { parseAndCheckHttpResponse } from 'apollo-link-http-common';\nimport { print } from 'graphql';\n\nconst mockOperation = {\n  query: print(`query GetGreeting { greeting }`),\n  variables: {},\n  operationName: 'GetGreeting',\n  extensions: {}\n};\n\nasync function handleMockResponse() {\n  // This is a simplified example demonstrating an internal utility function.\n  // In a real scenario, you'd have a 'Response' object from a fetch call.\n  const mockResponse = new Response(JSON.stringify({\n    data: { greeting: 'Hello World!' }\n  }), {\n    status: 200,\n    headers: { 'Content-Type': 'application/json' }\n  });\n\n  try {\n    const result = await parseAndCheckHttpResponse(mockOperation, mockResponse);\n    console.log('Parsed GraphQL result:', result);\n  } catch (error) {\n    console.error('Error parsing response:', error);\n  }\n}\n\nhandleMockResponse();\n","lang":"typescript","description":"This example demonstrates how an internal utility like `parseAndCheckHttpResponse` from `apollo-link-http-common` would process a mock HTTP response into a GraphQL result. It highlights the package's internal, lower-level role in handling network responses, not its direct use in creating an Apollo Link. This package is deprecated; for actual Apollo Client HTTP networking, use `@apollo/client/link/http`."},"warnings":[{"fix":"Migrate your application to use `@apollo/client/link/http` and other `@apollo/client` features directly. Remove all `apollo-link`, `apollo-link-http`, and `apollo-link-http-common` dependencies.","message":"The `apollo-link` ecosystem, including `apollo-link-http-common`, is deprecated as of Apollo Client 3.0. Its functionalities have been moved directly into `@apollo/client`. Direct usage of this package is strongly discouraged, and existing implementations should migrate.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Avoid direct reliance on this package if possible. If you must use it (e.g., in a legacy `apollo-link` setup), pin exact versions and rigorously test updates. The recommended fix is to migrate to `@apollo/client`.","message":"The README explicitly states that the API of `apollo-link-http-common` is subject to change and versions may not follow SemVer. This means breaking changes can occur even between minor or patch versions.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Recognize this package's internal role. For user-facing HTTP links, use the stable `HttpLink` from `@apollo/client` (since v3) or `apollo-link-http` (for older Apollo Client versions).","message":"This package is primarily an internal utility. It never reached a 1.0 stable release, indicating it was always considered experimental or unstable for external consumption. Direct usage by end-users is not its intended purpose.","severity":"gotcha","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Remove the `apollo-link-http-common` dependency. The functionality is now integrated into `@apollo/client/link/http`. Adapt your code to use `@apollo/client`'s native HTTP link functionality.","cause":"Attempting to use `apollo-link-http-common` in a modern Apollo Client (v3+) project where it has been deprecated and removed.","error":"Cannot find module 'apollo-link-http-common' or its corresponding type declarations."},{"fix":"Install `graphql` as a dependency: `npm install graphql` or `yarn add graphql`. Ensure its version is compatible with the peer dependency range specified.","cause":"The `graphql` peer dependency is not installed or its version does not satisfy the specified range (`^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0`).","error":"Error: Cannot find module 'graphql'"}],"ecosystem":"npm"}