microsoft / kiota-typescript

TypeScript libraries for Kiota-generated API clients.
https://aka.ms/kiota/docs
MIT License
32 stars 25 forks source link

Add support for "application/problem+json" content type #1254

Closed grzegorz-ogrodowski closed 3 days ago

grzegorz-ogrodowski commented 4 days ago

Hi, I think there is a need to add support for "application/problem+json" content type. There is a case when results come from API in json format and has "application/problem+json" content type. jsonParseNodeFactory throws error: "expected a "application/json content type".

As a workaround I wrote my own JsonParseNodeFactory, but I think it should be part of Kiota framework.

andrueastman commented 4 days ago

Thanks for raising this @grzegorz-ogrodowski

I believe the code here should already be handling this by normalizing the content type as appropriate so as to handle application/problem+json as application/json.

https://github.com/microsoft/kiota-typescript/blob/d2049023e3e60fedd031bc73ee3edf5ffa8693d2/packages/abstractions/src/serialization/parseNodeFactoryRegistry.ts#L33

Any chance you can confirm if this behavior is not happening on your end? Are you calling the serializer in specific way?

grzegorz-ogrodowski commented 3 days ago

Ok, It works. I used ParseNodeFactoryRegistry and I get proper result.

Topic can be closed, thank you for help