json method
Sends JSON response with security headers.
Implementation
Future<HttpResponse> json([dynamic data]) async {
response.headers.contentType = ContentType.json;
_defaultHeaders.forEach((key, value) {
response.headers.set(key, value);
});
return response
..statusCode = HttpStatus.ok
..write(jsonEncode(data))
..close();
}