asNotModified method

APIResponse<T> asNotModified({
  1. T? payload,
  2. Object? payloadDynamic,
  3. Map<String, dynamic>? headers,
  4. Object? mimeType,
  5. Etag? eTag,
  6. CacheControl? cacheControl,
  7. Duration? keepAliveTimeout,
  8. int? keepAliveMaxRequests,
  9. Map<String, APIMetric>? metrics,
})

Transform this response to a NOT_MODIFIED response.

Implementation

APIResponse<T> asNotModified({
  T? payload,
  Object? payloadDynamic,
  Map<String, dynamic>? headers,
  Object? mimeType,
  Etag? eTag,
  CacheControl? cacheControl,
  Duration? keepAliveTimeout,
  int? keepAliveMaxRequests,
  Map<String, APIMetric>? metrics,
}) {
  return APIResponse.notModified(
    payload: payload ?? (payloadDynamic == null ? this.payload : null),
    payloadDynamic: payloadDynamic,
    headers: headers ?? this.headers,
    mimeType: mimeType ?? payloadMimeType,
    eTag: eTag ?? payloadETag,
    cacheControl: cacheControl ?? this.cacheControl,
    keepAliveTimeout: keepAliveTimeout ?? this.keepAliveTimeout,
    keepAliveMaxRequests: keepAliveMaxRequests ?? this.keepAliveMaxRequests,
    metrics: metrics ?? _metrics,
  ).._copyStartedMetrics(this);
}