StuMason/coolify-mcp
TypeScript
Pull Request Merged
PR #177 merged: fix: parse non-json Coolify responses defensively
Summary
Fixes #163.
Changes
- Parse
request<T>responses based on the responseContent-Typeinstead of unconditionally callingJSON.parse. - Fall back to raw text for
text/plainresponses and malformed JSON bodies while preserving JSON parsing for JSON and+jsoncontent 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=falsenpm run buildnpm run lintnpm 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