Skip to content

Commit 3f8bc74

Browse files
authored
fix-null-body-csharp (#47)
1 parent a3a4110 commit 3f8bc74

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/generators/client/CSharpClientGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ using System.Runtime.Serialization;
219219
{
220220
Method = new HttpMethod(method),
221221
RequestUri = new Uri($"{ClientSettings.BaseUrl.TrimEnd('/')}/{path.TrimStart('/')}"),
222-
Content = new StringContent(JsonConvert.SerializeObject(body), null, "application/json"),
222+
Content = body != null ? new StringContent(JsonConvert.SerializeObject(body), null, "application/json") : null,
223223
};
224224
headers?.Keys.ToList().ForEach(x => req.Headers.TryAddWithoutValidation(x, headers[x]));
225225
await ClientSettings.PreRequest?.Invoke(req);

0 commit comments

Comments
 (0)