headers method

Map headers(
  1. SocketConnect connect, [
  2. Map? headers
])

Returns headers for a response.

Implementation

Map headers(SocketConnect connect, [Map? headers]) {
  headers = headers ?? {};

  // prevent XSS warnings on IE
  // https://github.com/LearnBoost/socket.io/pull/1333
  var ua = connect.request.headers.value('user-agent');
  if (ua != null && (ua.contains(';MSIE') || ua.contains('Trident/'))) {
    headers['X-XSS-Protection'] = '0';
  }

  emit('headers', headers);
  return headers;
}