Skip to content

fix: store HTTP response body as raw string#723

Draft
alexluong wants to merge 1 commit intomainfrom
response-body-raw-string
Draft

fix: store HTTP response body as raw string#723
alexluong wants to merge 1 commit intomainfrom
response-body-raw-string

Conversation

@alexluong
Copy link
Collaborator

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 change

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).

Test plan

  • go build ./...
  • go test ./internal/destregistry/...
  • go test ./internal/apirouter/...
  • go test ./internal/logstore/...

🤖 Generated with Claude Code

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>
@vercel
Copy link

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 Mar 4, 2026 3:21pm
outpost-website Ready Ready Preview, Comment Mar 4, 2026 3:21pm

Request Review

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