unosquare / embedio

A tiny, cross-platform, module based web server for .NET
http://unosquare.github.io/embedio
Other
1.45k stars 175 forks source link

JSON is incorrectly surrounded by double quotes as of 3.4.1 #557

Closed smitha-cgi closed 2 years ago

smitha-cgi commented 2 years ago

Describe the bug When a string is returned to a client via SendDataAsync, from version 3.4.1 onwards the string is surrounded by double quotes.

To Reproduce Create a simple class object and convert it into JSON using the Newtonsoft JsonConvert.SerializeObject method. Then return that string to the client via SendDataAsync.

Expected behavior Raw JSON is returned without surrounding quotes.

Screenshots

3.3.3 3 3 3

3.4.1 3 4 1

Desktop (please complete the following information):

Additional context N/A

rdeago commented 2 years ago

Hello @smitha-cgi, thanks for using EmbedIO!

Expected behavior Raw JSON is returned without surrounding quotes.

Uhm, no. SendDataAsync is expected to serialize data. You should use SendStringAsync to send a string "as is".

I'm not sure why version 3.3.3 worked as you describe, because its source code hansn't ever changed since its introduction in v3.0.0.

Closing as "not a bug".