Skip to content

Test all modules in npm test; fix axios/got/superagent on 4xx#1

Merged
proxymesh merged 2 commits intomainfrom
test-all-modules-and-fix-failures
Mar 8, 2026
Merged

Test all modules in npm test; fix axios/got/superagent on 4xx#1
proxymesh merged 2 commits intomainfrom
test-all-modules-and-fix-failures

Conversation

@proxymeshai
Copy link
Copy Markdown
Collaborator

@proxymeshai proxymeshai commented Mar 8, 2026

Changes

  • npm test now explicitly runs all six modules: core, axios, node-fetch, got, undici, superagent so npm test always tests every module regardless of how the script is invoked.

  • Axios, Got, Superagent tests no longer fail when the test URL returns 4xx (e.g. https://proxymesh.com/api/headers/ returning 400 for some User-Agents). The harness only needs to verify that proxy headers are sent and received; it does not require a 2xx from the target.

    • Axios: validateStatus: () => true on the request
    • Got: gotOptions: { throwHttpErrors: false } when creating the client
    • Superagent: .ok(() => true) on the request

Made with Cursor

- npm test: explicitly run core, axios, node-fetch, got, undici, superagent
- Axios: use validateStatus: () => true so proxy header check works when target returns 4xx
- Got: create client with throwHttpErrors: false for same reason
- Superagent: chain .ok(() => true) so response is returned on 4xx

Made-with: Cursor
- When SEND_PROXY_HEADER and SEND_PROXY_VALUE are set and we check the same
  header, test now requires the proxy response value to equal SEND_PROXY_VALUE.
- ProxyHeadersAgent: stop returning proxySocket from createConnection so the
  agent uses only the callback stream (tlsSocket). Returning the raw socket let
  the agent write the request before CONNECT completed, so the proxy sometimes
  ignored our X-ProxyMesh-IP and assigned a different IP.
- utils.buildConnectRequest: support proxyHeaders as Map for consistency.

Made-with: Cursor
@proxymesh proxymesh merged commit cbcb0f7 into main Mar 8, 2026
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.

2 participants