HttpResponse.text constructor
HttpResponse.text(
- String text, {
- HttpStatus status = HttpStatus.ok,
Create a successful response with text body
Implementation
factory HttpResponse.text(String text, {HttpStatus status = HttpStatus.ok}) {
final body = utf8.encode(text);
return HttpResponse(
status: status,
headers: {
'content-type': 'text/plain; charset=utf-8',
'content-length': body.length.toString(),
},
body: body,
);
}