Skip to content

fix: store HTTP response body as raw string#723

Merged
alexluong merged 2 commits intomainfrom
response-body-raw-string
Apr 8, 2026
Merged

fix: store HTTP response body as raw string#723
alexluong merged 2 commits intomainfrom
response-body-raw-string

Conversation

@alexluong
Copy link
Copy Markdown
Collaborator

@alexluong alexluong commented Mar 4, 2026

Summary

Context

After #714 switched Event.Data to json.RawMessage and #718 migrated PG columns from JSONB to TEXT, response data is the remaining place where we parse and restructure data rather than preserving it verbatim.

Currently, when a destination returns a JSON response, we unmarshal the body into a Go map. This:

  1. Loses the original key ordering
  2. Treats JSON and non-JSON responses inconsistently

This change stores the body as-is, matching our approach for event data integrity.

Breaking changes

API: response_data.body is now always a string, even when the destination returns application/json.

Before — JSON response body was a parsed object:

{
  "status": 200,
  "body": {
    "id": "usr_123",
    "status": "created",
    "metadata": { "source": "api" }
  }
}

After — body is the raw response string:

{
  "status": 200,
  "body": "{\"id\":\"usr_123\",\"status\":\"created\",\"metadata\":{\"source\":\"api\"}}"
}

Non-JSON responses are unchanged (already stored as strings).

Database: attempts.response_data column is migrated from JSONB to TEXT (migration 000009). Serialization is now handled in application code, consistent with events.data and attempts.event_data.

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
outpost-docs Ready Ready Preview, Comment Apr 8, 2026 3:16pm
outpost-website Ready Ready Preview, Comment Apr 8, 2026 3:16pm

Request Review

Previously, ParseHTTPResponse would unmarshal JSON response bodies into
map[string]interface{}, losing original key ordering. Now the body is
always stored as a raw string regardless of content type, consistent
with how event data preserves payload integrity.

Breaking change: response_data.body is now always a string, even when
the destination returns application/json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Completes the raw-string storage approach started in #714/#718.
The response_data column was the last JSONB column storing delivery
data — convert it to TEXT so serialization is handled in application
code, consistent with events.data and attempts.event_data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexluong alexluong merged commit 6f1d5c4 into main Apr 8, 2026
5 checks passed
@alexluong alexluong deleted the response-body-raw-string branch April 8, 2026 20:44
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