Open kikaragyozov opened 3 months ago
If you have written the following json string:
"{ \"msg\": \"Hello World!\\n\"}"
For a webhook's payload in your appsettings.json configuration file, the library will fail to deserialize it, whereas if you pass the above string to System.Text.Json.JsonSerializer, it will successfully parse it.
System.Text.Json.JsonSerializer
After debugging, the issue occurs here: https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/76c1ad21552f65e8d8dfdd6a2107a2c6eaf25794/src/HealthChecks.UI/Middleware/UIWebHooksApiMiddleware.cs#L34
The Regex.Unescape call turns the above into an invalid json string. Why are we escaping exactly?
Regex.Unescape
Currently it's impossible to define a new line in the JSON webhook payload object, until the above is somehow addressed.
The exception is thrown when you go to the "Webhooks" section in the UI.
If you have written the following json string:
For a webhook's payload in your appsettings.json configuration file, the library will fail to deserialize it, whereas if you pass the above string to
System.Text.Json.JsonSerializer
, it will successfully parse it.After debugging, the issue occurs here: https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/76c1ad21552f65e8d8dfdd6a2107a2c6eaf25794/src/HealthChecks.UI/Middleware/UIWebHooksApiMiddleware.cs#L34
The
Regex.Unescape
call turns the above into an invalid json string. Why are we escaping exactly?Currently it's impossible to define a new line in the JSON webhook payload object, until the above is somehow addressed.
The exception is thrown when you go to the "Webhooks" section in the UI.