NSwag icon indicating copy to clipboard operation
NSwag copied to clipboard

Bug: string.Empty is not valid JSON

Open idea-lei opened this issue 8 months ago • 1 comments

When request body (POST, PUT, PATCH) is empty, NSWag generates a string content as following:

request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json;odata.metadata=minimal;odata.streaming=true");

Empty string is not valid json (should be "" or {} or just without this instruction) which causes exception.

VERSION: 14.08 and below

idea-lei avatar Jun 17 '24 09:06 idea-lei