Skip to content

fix: use application/json Content-Type for agent generate requests#34

Merged
MiguelPF merged 1 commit intomainfrom
fix-content-type-issue
Feb 6, 2026
Merged

fix: use application/json Content-Type for agent generate requests#34
MiguelPF merged 1 commit intomainfrom
fix-content-type-issue

Conversation

@MiguelPF
Copy link
Contributor

@MiguelPF MiguelPF commented Feb 6, 2026

Problem

The response method in lib/ai/clients/mastra.rb was setting Content-Type: text/plain;charset=UTF-8 while sending a JSON body. This caused the mastra server to not parse the request body correctly, resulting in Argument 'messages' is required errors.

Root Cause

The bug was present since the first commit (9639eff - June 10, 2025) but only became visible when the mastra server started strictly validating Content-Type headers for body parsing.

Fix

Changed line 290 from:

request['Content-Type'] = 'text/plain;charset=UTF-8'

to:

request['Content-Type'] = 'application/json'

Testing

Tested locally with meetings chat - the Argument 'messages' is required error no longer occurs.

The response method was incorrectly setting Content-Type to text/plain
while sending a JSON body. This caused the mastra server to not parse
the body correctly, resulting in 'Argument messages is required' errors.

This bug was present since the first commit but only became visible
when the mastra server started strictly validating Content-Type headers.
@MiguelPF MiguelPF requested a review from a team as a code owner February 6, 2026 11:30
@MiguelPF MiguelPF merged commit cf23907 into main Feb 6, 2026
1 check passed
@MiguelPF MiguelPF deleted the fix-content-type-issue branch February 6, 2026 11:39
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