-
Notifications
You must be signed in to change notification settings - Fork 347
Closed
Labels
emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharpIssue for the C# client emitter: @typespec/http-client-csharp
Description
Consider the following spec : link
Here the request body and the content type header are optional. The content type header should only be added to the request if the request body is not empty. Currently, we generate invalid code that will always add the content type parameter:
if ("application/xml" != null)
{
request.Headers.SetValue("Content-Type", "application/xml");
}Instead, we should check if the request content is null, and if not, apply the content type:
if (content != null)
{
request.Headers.SetValue("Content-Type", "application/xml");
request.Content = content;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharpIssue for the C# client emitter: @typespec/http-client-csharp