Response.notModified constructor

Response.notModified({
  1. Map<String, Object>? headers,
  2. Map<String, Object>? context,
})

Constructs a 304 Not Modified response.

This is used to respond to a conditional GET request that provided information used to determine whether the requested resource has changed since the last request. It indicates that the resource has not changed and the old value should be used.

headers must contain values that are either String or List<String>. An empty list will cause the header to be omitted.

If headers contains a value for content-length it will be removed.

Implementation

Response.notModified({
  Map<String, /* String | List<String> */ Object>? headers,
  Map<String, Object>? context,
}) : this(
        304,
        headers: removeHeader(
            addHeader(headers, 'date', formatHttpDate(DateTime.now())),
            'content-length'),
        context: context,
      );