ResponseWithCacheControl<T> constructor

ResponseWithCacheControl<T>(
  1. dynamic body, {
  2. required Request request,
  3. required T data,
})

Implementation

factory ResponseWithCacheControl(dynamic body,
    {required Request request, required T data}) {
  if (T == String) {
    return ResponseWithEtag(body, request: request, etag: data as String)
        as ResponseWithCacheControl<T>;
  }
  if (T == DateTime) {
    return ResponseWithLastModified(body,
        request: request,
        lastModified: data as DateTime) as ResponseWithCacheControl<T>;
  }
  throw UnimplementedError("Only String or DateTime implemented");
}