You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My API returns dates as ISO strings. Obviously I don't want to parse it everywhere on the go and thus want to to adjust the parsing of the response.
The default Response.json() method has no overload to adjust the parsing like JSON.parse(string, (key, value) => {}) thus one had to use .text() and parse the result manually. How can I archive this with the openapi-fetch library?
but sadly the static method Response.json() does convert any given object to a string and back thus killing all custom parsing. The library checks the response for a correct Response object via instanceof and thus I can't return a custom object with the correct structure (the code just crashes without any error and the webpage is broken).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
My API returns dates as ISO strings. Obviously I don't want to parse it everywhere on the go and thus want to to adjust the parsing of the response.
The default
Response.json()method has no overload to adjust the parsing likeJSON.parse(string, (key, value) => {})thus one had to use.text()and parse the result manually. How can I archive this with theopenapi-fetchlibrary?I tried the following:
but sadly the static method
Response.json()does convert any given object to a string and back thus killing all custom parsing. The library checks the response for a correctResponseobject viainstanceofand thus I can't return a custom object with the correct structure (the code just crashes without any error and the webpage is broken).How can I customize the response parsing?
Beta Was this translation helpful? Give feedback.
All reactions