MyAspNetCore icon indicating copy to clipboard operation
MyAspNetCore copied to clipboard

Suggestion: Add `$format` media type mappings

Open siimav opened this issue 1 year ago • 1 comments

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 avatar Jul 01 '23 15:07 siimav

@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.

xuzhg avatar Jul 04 '23 00:07 xuzhg