validate method

  1. @override
ValidationResult validate(
  1. covariant ValidationRequest<DateTime> request,
  2. covariant DateTime? data
)
override

Implementation

@override
ValidationResult validate(
    covariant ValidationRequest<DateTime> request, covariant DateTime? data) {
  if (data == null || request.validationData == null) {
    return ValidationResult.not();
  }
  if (data.millisecondsSinceEpoch ~/ 1000 >
      request.validationData!.millisecondsSinceEpoch ~/ 1000) {
    return ValidationResult.not();
  } else {
    return ValidationResult.ok(
        // contentType: validationResponse.contentType,
        headers: {
          HttpHeaders.lastModifiedHeader: HttpDate.format(data),
          HttpHeaders.contentLengthHeader: 0
        }, statusCode: 304);
  }
}