Finish axios migration via shared native HTTP helper

Replace all in-scope axios callsites with a new helpers/http.js wrapper over native fetch, including JSON/text GET, JSON POST, HEAD checks, and transient 5xx retry behavior; update all browser, build, script, and proxy API clients to use it; add focused unit tests; and remove axios from package dependencies.

Constraint: Preserve API/build and deployment behavior while lowering transport surface area.

Rejected: inline fetch replacements at each callsite | rejected to avoid inconsistent error/retry semantics.

Confidence: high

Scope-risk: moderate

Directive: Keep helper in place as the transport boundary and update tests when changing request semantics.

Tested: pnpm run -s typecheck, pnpm -s run test-prebuild, pnpm -s run test, pnpm -s run test:browser, pnpm -s run netlify-build, smoke GETs on /apple-silicon-app-test and /apple-silicon-app-test/?version=2

Not-tested: branch/netlify deployment health in CI pipeline after merge
This commit is contained in:
ThatGuySam 2026-04-06 12:09:16 -05:00
parent d39a2a1d6c
commit d45b587434
25 changed files with 824 additions and 267 deletions

View file

@ -1,7 +1,6 @@
import fs from 'fs-extra'
import has from 'just-has'
import { test, expect, beforeAll } from 'vitest'
import axios from 'axios'
import { JSDOM } from 'jsdom'
import { structuredDataTestHtml } from 'structured-data-testing-tool'
import { Google } from 'structured-data-testing-tool/presets'
@ -11,6 +10,7 @@ import {
getVideoImages,
ListingDetails
} from '~/helpers/listing-page.js'
import { getJson } from '~/helpers/http.js'
import { headPropertyTypes } from '~/test/helpers/head.js'
import { PageHead } from '~/helpers/config-node.js'
@ -73,8 +73,7 @@ beforeAll(async () => {
continue
}
const { data } = await axios.get(`${process.env.PUBLIC_API_DOMAIN}${apiPath}`)
context.listings[caseEndpoint] = data
context.listings[caseEndpoint] = await getJson( `${process.env.PUBLIC_API_DOMAIN}${apiPath}` )
}
// Initialize listing details