Skip to content

Conversation

@ryanfowler
Copy link
Owner

No description provided.

@ryanfowler ryanfowler requested a review from Copilot January 15, 2026 04:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors content-type handling to intelligently detect and set the content type from request body data, consolidating JSON and XML handling into a unified data field with automatic content type detection.

Changes:

  • Replaced separate JSON and XML fields with a single Data field and ContentType field
  • Moved content type detection logic from multipart package to a new shared core.DetectContentType function
  • Updated CLI flags to set appropriate content types while using the unified Data field

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
main.go Updated to pass ContentType field instead of separate JSON and XML fields to the request
internal/multipart/multipart.go Refactored to use shared core.DetectContentType function, removing duplicate content type detection code
internal/fetch/fetch.go Updated Request struct to use ContentType field instead of separate JSON and XML fields
internal/core/content_type.go New file implementing shared content type detection logic with extension-based and byte-sniffing fallback
internal/client/client.go Simplified request construction to use unified ContentType field instead of separate JSON/XML handling
internal/cli/app.go Refactored CLI to set ContentType appropriately for --data, --json, and --xml flags using tracking booleans

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ryanfowler ryanfowler merged commit 3580f08 into main Jan 15, 2026
10 checks passed
@ryanfowler ryanfowler deleted the body-content-type branch January 15, 2026 04:20
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