Stu Mason
Stu Mason

Activity

Pull Request Merged

PR #177 merged: fix: parse non-json Coolify responses defensively

Summary

Fixes #163.

Changes

  • Parse request<T> responses based on the response Content-Type instead of unconditionally calling JSON.parse.
  • Fall back to raw text for text/plain responses and malformed JSON bodies while preserving JSON parsing for JSON and +json content types.
  • Add regression coverage for plain-text application logs and malformed JSON responses.

Test plan

  • Tests added/updated
  • Manually tested locally

Validation run locally:

  • $env:NODE_OPTIONS='--experimental-vm-modules'; npx jest --testPathIgnorePatterns=integration --runInBand
  • $env:NODE_OPTIONS='--experimental-vm-modules'; npx jest --testPathIgnorePatterns=integration --runTestsByPath src/__tests__/coolify-client.test.ts --runInBand --coverage=false
  • npm run build
  • npm run lint
  • npm run format:check

npm run lint passes with the repository's existing warning-only no-explicit-any reports.

Checklist

  • Code follows project conventions
  • Documentation updated if needed
+47
additions
-3
deletions
2
files changed