Skip to content

fix: handle string body in test executor to avoid double JSON encoding#90

Merged
mikolajbadyl merged 2 commits intomainfrom
fix/executor-string-body
Feb 28, 2026
Merged

fix: handle string body in test executor to avoid double JSON encoding#90
mikolajbadyl merged 2 commits intomainfrom
fix/executor-string-body

Conversation

@mikolajbadyl
Copy link
Member

The agent sends request bodies as JSON strings (per the ExecuteTestGroup tool schema: "type": ["string", "null"]). The executor was calling json.Marshal on that string, which double-encoded it — the server received "{\name\:\"Alice\"}" instead of {"name":"Alice"}, causing all POST/PUT/PATCH requests to fail with 400.

Fix: if body is already a string, pass it directly to the request reader instead of marshaling it again.

@kilo-code-bot
Copy link

kilo-code-bot bot commented Feb 28, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • internal/core/tester/executor.go - No issues

Analysis:
The PR correctly adds string body handling by using a type switch:

  • When body is a non-empty string, it uses strings.NewReader(b) directly
  • For other types, it marshals to JSON as before

The Content-Type: application/json header is unchanged in this PR (appears as context line in diff), so any concerns about header/body mismatch are pre-existing and outside the scope of this change.

@mikolajbadyl mikolajbadyl merged commit f7232b7 into main Feb 28, 2026
1 check passed
@mikolajbadyl mikolajbadyl deleted the fix/executor-string-body branch February 28, 2026 10:13
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