-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the bug
With the removal of AddHandler
the check for wildcards is probably lost. So there is no deserialization when the server sends a content type of e.g. application/vnd.somebody.something+json
.
To Reproduce
Just try to deserialize something from an API that sends a content type like application/vnd.somebody.something+json
.
Expected behavior
That the serialization of content types like "application/vnd.somebody.something+json" works.
Stack trace
There is no Stack trace
Desktop (please complete the following information):
- OS: Windows 10 (20H2)
- .NET version: 4.7.2
- Version: 107.1.1
Additional context
Currently the json serializer supports the following strings:
"application/json", "text/json", "text/x-json", "text/javascript", "*+json"
If an API now returns e.g. application/json
everything is ok and the deserialization works. But if the API returns e.g. application/vnd.somebody.something+json
there is no deserialization. Since here:
https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/RestClient.Serialization.cs#L94
is only checked with a Contains
. So there is no match on *+json
and no matching serializer is found and no deserialization is done.
If you copy e.g. JsonNetSerializer
and name it JsonNetSerializerNew
and add SupportedContentTypes
to application/vnd.somebody.something+json
everything works perfectly, because the Contains
is matched again.
PR #1709 partially fixes the problem (since DetectContentType acts as a fallback here). However, it does not fix the original problem that WildCards are no longer supported.