json method
Sets the response body as a json string and adds a json content type if the content type isn't set.
Implementation
void json(Map<String, dynamic> contents) {
body = jsonEncode(contents);
headers.putIfAbsent("Content-Type", () => ["application/json"]);
}