postman-code-generators icon indicating copy to clipboard operation
postman-code-generators copied to clipboard

C# use verbatim string

Open carl-di-ortus opened this issue 5 years ago • 0 comments

Current generated requests are a tragedy to read. We could improve this a bit by introducing a verbatim string with @ prefix. Instead of this:

request.AddParameter("application/json", "{ \r\n \"order\":{ \r\n \"items\":[ \r\n { \r\n \"name\": ...

It could be like this:

request.AddParameter("application/json", @"{
    ""order"": {
        ""items"": [
            {
                ""name"": ...

If accepted, it would probably be a good idea to make this as a toggleable setting, for users that want to have these long one-lines or for others that want to have it in semi-formatted way.

A good source for information - https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/verbatim

carl-di-ortus avatar Feb 26 '21 08:02 carl-di-ortus