Closed stevenheyvaert closed 7 months ago
The JSON serializers (both the one for System.Text.Json and the one for Newtonsoft JSON.NET) included with Rebus 8 will either throw a KeyNotFoundExcepton
saying something like
System.Collections.Generic.KeyNotFoundException: Could not find the key 'rbs2-content-type' - have the following keys only: 'rbs2-msg-id', 'rbs2-corr-id'
(...)
or throw a FormatException
saying something like
System.FormatException: Unknown content type: 'application/x-protobuf' - must be 'application/json' (e.g. 'application/json;charset=utf-8') for the JSON serialier to work
(...)
when they encounter an unexpected value as the rbs2-content-type
header.
When the 'rbs2-content-type' custom property is missing, a NullReferenceException is thrown.
It would be nicer if this falls back to 'application/json', or at least give a better exception (ArgumentNullException or the like?)
As a result, in fleetmanager, the original body is not shown as well.
IMHO, a fallback to default 'application/json' would be the easiest thing to do.