Closed steve-solcast closed 3 years ago
I've removed the hard coded references to Content Types in this commit so it should be using registered content types by default where you should be able to use ?format=x-somename+format
This change is available from the latest v5.10.5 that's now available on MyGet.
ServiceStack supports the format= query string parameter to set the ResponseContentType.
In creating custom standard types the correct format to use is application/x-somename+format. eg application/x-solcast+json
Unfortunately, HttpRequestExtensions.GetQueryStringContentType overrides any custom format if it contains any of "json", "xml" or "jsv".
This forces you to always use an Accept header to pass any registered custom format.
The offending code is:-
Perhaps if the HostContext.ContentTypes.ContentTypeFormats.TryGetValue(format, out var contentType);
occured prior to the "else ..." the validly registeredd custom formats would work as expected, but the "attempted fix" code would not be broken.