MyAspNetCore
MyAspNetCore copied to clipboard
Suggestion: Add `$format` media type mappings
https://github.com/xuzhg/MyAspNetCore/blob/f08a774c4bbe160f6359ad5241b713c70112789c/src/ODataCustomizePayloadFormat/ODataCustomizePayloadFormat/Program.cs#L18-L24
In addition to adding SupportedMediaTypes
, I would also suggest adding MediaTypeMappings
, for example:
odataFormatter.MediaTypeMappings.Add(new QueryStringMediaTypeMapping("$format", "csv", "text/csv"));
Took me a while to figure out why appending ?$format=text/csv
to URL didn't yield expected results. I imagine someone else could also run into the same issue.
@siimav thanks for your sharing. Would you mind to share your contribution by creating a PR? I'd love to merge it and value from your contribution. thanks.