Skip to content

fix(#1135): Viator client must send Accept-Language (live sandbox 400 INVALID_HEADER_VALUE)#1207

Merged
Systemsaholic merged 1 commit into
mainfrom
feature/issue-1135-viator-accept-language-header
Jun 26, 2026
Merged

fix(#1135): Viator client must send Accept-Language (live sandbox 400 INVALID_HEADER_VALUE)#1207
Systemsaholic merged 1 commit into
mainfrom
feature/issue-1135-viator-accept-language-header

Conversation

@Systemsaholic

@Systemsaholic Systemsaholic commented Jun 26, 2026

Copy link
Copy Markdown
Owner

What

One-line fix surfaced by the live sandbox dry-run verification of #1135 Spec B Phase 1 (now that VIATOR_API_KEY is provisioned). Refs #1135.

The Viator Partner API requires an Accept-Language header — without it every call returns 400 {"code":"INVALID_HEADER_VALUE","message":"Invalid value for header: Accept-Language"}. The merged ViatorContentClient sent only Accept: application/json;version=2.0 + exp-api-key, so all live ingest (destinations/tags/products/details) would have 400'd. P1b was fixture-tested with a mocked HTTP layer, so the missing header was invisible until a real server saw it.

Confirmed via curl: same call without Accept-Language → 400; with Accept-Language: en-US → 200.

Fix

Add 'Accept-Language': 'en-US' to the client's private versionHeaders getter — the shared header source for getDestinations / getTags / getProductsModifiedSince / getDetails. (Hardcoded en-US is fine for now; app is en-only. Config-driving it can wait for real localization.)

Live verification (sandbox, zero writes) — after the fix

  • AUTH 200 on all calls (no 401).
  • destinations: 3388 fetched / 3388 mapped
  • tags: 1263 / 1263
  • products: 2 pages, 100 fetched / 100 mapped, cursor advanced
  • 0 mapper errors — the merged mappers parse live sandbox shapes.

Regression test

New viator-content.client.spec.ts spies on the actual outgoing request and asserts all three required headers (exp-api-key + versioned Accept + Accept-Language) on the destinations and products feeds — the guard the fixture-only suite lacked. 2/2 pass.

Verification

  • 2/2 jest; tsc clean for the touched files; git diff --check clean.
  • Codex (gpt-5.5 xhigh): APPROVE — confirmed all Viator content methods use versionHeaders (no bypass), the auth-header merge preserves Accept/Accept-Language, and the spec verifies the real outgoing request. Codex re-ran the suite (2/2).

This unblocks Phase-1 live ingest. The catalog still only ingests on Prod (Rule #5/FDW) with the prod key (post-certification); this fix makes the dry-run + future live ingest actually authenticate against Viator.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Added a missing language header to outgoing Viator API requests, helping ensure requests are accepted reliably.
    • Strengthened request validation with coverage that checks required headers and request parameters, reducing the chance of regressions.

… INVALID_HEADER_VALUE)

The Viator Partner API REQUIRES an Accept-Language header — without it every
call returns 400 INVALID_HEADER_VALUE. The P1b ViatorContentClient only sent
`Accept: application/json;version=2.0` + the exp-api-key, so ALL live ingest
(destinations/tags/products) would 400. P1b was fixture-tested with a mocked
HTTP layer, so the missing header was invisible until the live sandbox dry-run
(VIATOR_API_KEY just provisioned) hit the 400.

Fix: add `Accept-Language: en-US` to the client's shared versionHeaders (used by
all feeds + getDetails). Verified live against sandbox after the fix:
destinations 3388/3388 mapped, tags 1263/1263, products 2 pages/100 mapped,
cursor advanced, 0 errors.

Adds a regression spec that spies on the outgoing request and asserts all three
required headers (exp-api-key + versioned Accept + Accept-Language) on the
destinations and products feeds — the guard the fixture-only tests lacked.

Refs #1135
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tailfire-client Ready Ready Preview, Comment Jun 26, 2026 12:09pm
tailfire-ota Ready Ready Preview, Comment Jun 26, 2026 12:09pm

Request Review

@Systemsaholic Systemsaholic merged commit 5cbc6ce into main Jun 26, 2026
11 of 17 checks passed
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 35f9bc55-b7ed-4b04-8b28-3fa04cbfc2e8

📥 Commits

Reviewing files that changed from the base of the PR and between ba09b5b and d062550.

📒 Files selected for processing (2)
  • apps/api/src/external-apis/providers/viator/viator-content.client.spec.ts
  • apps/api/src/external-apis/providers/viator/viator-content.client.ts

📝 Walkthrough

Walkthrough

The Viator content client now sends Accept-Language: en-US with versioned requests, and the new spec verifies the outgoing headers and request params for destination and modified-since calls.

Changes

Viator request header contract

Layer / File(s) Summary
Header update and request spec
apps/api/src/external-apis/providers/viator/viator-content.client.ts, apps/api/src/external-apis/providers/viator/viator-content.client.spec.ts
versionHeaders adds Accept-Language: en-US, and the new Jest spec checks the request headers and params sent by ViatorContentClient.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A bunny hops through headers bright,
With en-US tucked in just right.
I sniff the request,
And give it a test,
Then nibble carrots—what a sight!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/issue-1135-viator-accept-language-header

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/api/src/external-apis/providers/viator/viator-content.client.spec.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: ESLint configuration in --config is invalid:

  • Property "" is the wrong type (expected object but got "import config from \"@tailfire/config/eslint/flat-node\";\nexport default config;").

    at ConfigValidator.validateConfigSchema (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2177:19)
    at ConfigArrayFactory._normalizeConfigData (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3019:19)
    at ConfigArrayFactory._loadConfigData (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2984:21)
    at ConfigArrayFactory.loadFile (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2850:40)
    at createCLIConfigArray (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3660:35)
    at new CascadingConfigArrayFactory (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3735:29)
    at new CLIEngine (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js:617:36)
    at new ESLint (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js:430:27)
    at Object.execute (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js:410:24)
    at async main (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js:152:22)

apps/api/src/external-apis/providers/viator/viator-content.client.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: ESLint configuration in --config is invalid:

  • Property "" is the wrong type (expected object but got "import config from \"@tailfire/config/eslint/flat-node\";\nexport default config;").

    at ConfigValidator.validateConfigSchema (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2177:19)
    at ConfigArrayFactory._normalizeConfigData (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3019:19)
    at ConfigArrayFactory._loadConfigData (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2984:21)
    at ConfigArrayFactory.loadFile (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2850:40)
    at createCLIConfigArray (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3660:35)
    at new CascadingConfigArrayFactory (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3735:29)
    at new CLIEngine (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js:617:36)
    at new ESLint (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js:430:27)
    at Object.execute (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js:410:24)
    at async main (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js:152:22)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant