How to use the contentful-sdk-core.createHttpClient function in contentful-sdk-core

To help you get started, we’ve selected a few contentful-sdk-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github contentful / contentful.js / lib / contentful.js View on Github external
const config = {

  const userAgentHeader = getUserAgentHeader(`contentful.js/${__VERSION__}`,
  config.headers = {
    'Content-Type': 'application/',
    'X-Contentful-User-Agent': userAgentHeader

  const http = createHttpClient(axios, config)

  const getGlobalOptions = createGlobalOptions({
    resolveLinks: config.resolveLinks,
    environment: config.environment,
    removeUnresolved: config.removeUnresolved,
    spaceBaseUrl: http.defaults.baseURL,
    environmentBaseUrl: `${http.defaults.baseURL}environments/${config.environment}`
  // Append environment to baseURL
  http.defaults.baseURL = getGlobalOptions().environmentBaseUrl

  // Intercepts response and obscure the token

  return createContentfulApi({
github contentful / contentful-management.js / lib / contentful-management.js View on Github external
params = {

  if (!params.accessToken) {
    throw new TypeError('Expected parameter accessToken')

  params.headers = {

  const http = createHttpClient(axios, params)
  const api = createContentfulApi({
    http: http

  return api


Core modules for the Contentful JS SDKs

Latest version published 5 days ago

Package Health Score

84 / 100
Full package analysis

Similar packages