-
Notifications
You must be signed in to change notification settings - Fork 384
Open
Labels
package:httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Hello! 👋
I'm trying to use the OpenAI Realtime API and need to send Content-Type: application/sdp
as one of the headers.
Here's what my Dart code looks like
final response = await http.post(
Uri.parse('$baseUrl?model=$model'),
headers: {
'Authorization': 'Bearer $ephemeralKey',
'Content-Type': 'application/sdp',
},
body: sdp,
encoding: null
);
Even though I'm setting the header to application/sdp
the request sent has the header set to application/sdp; charset=utf-8
(I tested this with iOS, macOS and Web debug targets)
And looks like the OpenAI endpoint is very strict about the value it accepts for this header:
Response body: {"error":{"message":"Unsupported content type. This API method only accepts 'application/sdp' requests, but you specified the header 'Content-Type: application/sdp; charset=utf-8'. Please try again with a supported content type.","type":"invalid_request_error","param":null,"code":"unsupported_content_type"}}
Is there any way to prevent the http
library from modifying headers before the request is made?
Metadata
Metadata
Assignees
Labels
package:httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)