Open gaetschwartz opened 1 year ago
@gaetschwartz thanks for this - what's the use case for the jsify
method?
Well, as jsify
can translate Dart objects to Js objects directly, people could still have some use. As it was the old behavior I figured I would leave it.
I'm not really familiar with the project, but it looks alright at a quick glance.
I'd still consider this a breaking change (since the "json" constructor changes). And it'd be great to have some tests. But the project doesn't seem to have some atm, so that's alright I guess
Changes
Response
constructorsResponse.jsify
method for initializingResponse
with a JS object as bodyResponse.json
method fromResponse.jsify
for initializingResponse
with a JSON-encodable object as bodyResponse
Motivation
jsify
is subject to minification and has somewhat bad performance. When usingdart compile
with minification enabled, the response json gets minified (after a certain depth AFAIK). It should not be the case. The newResponse.json
behaves simlarly from the previous implementation except that it doesn't minify as it usesjson.encode
. Renamed the previous implementation toResponse.jsify
as it could still be useful for some cases.