addResponseHeader method

void addResponseHeader(
  1. Map<String, Object?> headers
)

Adds default headers to the responses, HTTP/2 ones and those of the HTTP/1 requests that allowHttp1 serves, by the rules of AngelHttp.addResponseHeader: a header that a handler sets replaces one of the same name. Unlike that one, it may be called before startServer too.

A header that cannot be sent throws an ArgumentError, and none of headers is added.

Implementation

void addResponseHeader(Map<String, Object?> headers) {
  var copy = copyHeaders(headers);
  checkHeaders(copy);
  _changeHttp1Defaults((d) => d.addValues(copy));
  _http2Defaults.add(copy);
}