hi,
I return a model object from a route, the object has a "toJson()" function, as expected by the fallback serializable type handler, the function is called and the response is sent, however my client side parser fails because it receives the response as a string, while it was expected a json.
i think that the serializable handler should sent a ContentType.json content type header like the json type handler :
if (value.toJson != null) {
**res.headers.contentType = ContentType.json;**
res.write(jsonEncode(value.toJson()));
return res.close();
}
...
if (value.toJSON != null) {
**res.headers.contentType = ContentType.json;**
res.write(jsonEncode(value.toJson()));
return res.close();
}
hi,
I return a model object from a route, the object has a "toJson()" function, as expected by the fallback serializable type handler, the function is called and the response is sent, however my client side parser fails because it receives the response as a string, while it was expected a json.
i think that the serializable handler should sent a ContentType.json content type header like the json type handler :
...