extract method
Produces the value, or the rejection that stops the handler.
Implementation
@override
Future<Result<String, Rejection>> extract(Request request) async {
switch (await readBody(request, limit: limit)) {
case Err(:final error):
return Err(error);
case Ok(:final value):
try {
return Ok(utf8.decode(value));
} on FormatException {
return const Err(Rejection.badRequest('body is not valid UTF-8'));
}
}
}