The default output of an HTTP response is composed of the headers.
181514
public function issue()
    {
        // If there is no next URL, just output the headers as expected.
        foreach ($this->headers as $key => $value) {
            header("{$key}: {$value}", true);
        }

        // Output content type.
        if ($this->contentType) {
            header("content-type: {$this->contentType}; charset={$this->encoding}");
        }

        // Output status code.
        $statusMessage = sprintf('%d %s',
            $this->status,
            HttpClient::getStatusCodeMessage($this->status)
        );
        header('Status: ' . $statusMessage);
    }
591810
function(reg) {
			var key = reg.header;
			key += (i*2).toString();
			key += reg.footer;
			self.responses[key] = reg.val;
		}
272413
protected function defaultHeaders()
    {
        if (function_exists('getallheaders')) {
            $headers = getallheaders();
        } elseif (function_exists('http_get_request_headers')) {
            $headers = http_get_request_headers();
        } else {
            $headers = [];
            foreach ($_SERVER as $name => $value) {
                if (strncmp($name, 'HTTP_', 5) === 0) {
                    $name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
                    $headers[$name] = $value;
                }
            }
        }

        return $this->filterHeaders($headers);
    }
637557
protected function _generateProxyResponseHeaders()
    {
        header($this->_responseHeaders['status']);

        // Let the server handle the Content-Lenght and Transfer-Encoding headers
        unset($this->_responseHeaders['Content-Length']);
        unset($this->_responseHeaders['Transfer-Encoding']);

        foreach($this->_responseHeaders as $name => $value)
        {
            if($name != 'status')
                header("$name: $value");
        }
    }
829019
def _format_response(self, request, response):
        

        res = datamapper.format(request, response, self)
        # data is now formatted, let's check if the status_code is set
        if res.status_code is 0:
            res.status_code = 200
        # apply headers
        self._add_resposne_headers(res, response)
        return res
1138743
def http_headers
      env.select { |k, _v| (k.start_with?("HTTP_") && k != "HTTP_VERSION") || k == "CONTENT_TYPE" }
        .collect { |k, v| [k.sub(/^HTTP_/, ""), v] }
        .collect { |k, v| [k.split("_").collect(&:capitalize).join("-"), v] }
    end
1112186
function getOperationResponseHeaders(operation) {
    var headers = [];

    if (operation) {
        _.each(operation.responses, function(response, responseCode) {
            // Convert responseCode to a numeric value for sorting ("default" comes last)
            responseCode = parseInt(responseCode) || 999;

            _.each(response.headers, function(header, name) {
                // We only care about headers that have a default value defined
                if (header.default !== undefined) {
                    headers.push({
                        order: responseCode,
                        name: name.toLowerCase(),
                        value: header.default
                    });
                }
            });
        });
    }

    return _.sortBy(headers, 'order');
}
1300341
def set_response_defaults(self, response, request=None):
        """"""
        for header_name, header_value in self.response_headers:
            response.set_header(header_name, header_value)
        if self.set_status:
            response.status = self.set_status
        response.content_type = self.content_type(request, response)
974570
public static ResponseEncoding determineResponseEncodingWithDefault(RequestDetails theReq) {
		ResponseEncoding retVal = determineResponseEncodingNoDefault(theReq, theReq.getServer().getDefaultResponseEncoding());
		if (retVal == null) {
			retVal = new ResponseEncoding(theReq.getServer().getFhirContext(), theReq.getServer().getDefaultResponseEncoding(), null);
		}
		return retVal;
	}
1081302
public function createHeader() {
    if ($this->router->isTestRun()) {
      return;
    }

    http_response_code($this->getStatusCode());
    if ($this->response === null) {
      // exception was raised
      // FIXME ensure that a response is always given initialized with at least the content type header
      header(Header::CONTENT_TYPE . ":" . $this->getContentType());
    } else {
      foreach ($this->response->getHeaders() as $header => $value) {
        header($header . ":" . $value);
      }
    }
  }
200108
function (string) {
    if (!string || string === '' || string.indexOf('\r\n') === -1) {
      return {
        version: 'HTTP/1.1',
        statusText: ''
      }
    }

    var lines = string.split('\r\n')
    var status = lines.shift()

    // Remove empty strings
    lines = lines.filter(Boolean)

    // Parse status line
    var output = this.parseStartLine(status)

    // init headers object & array
    output.headersObj = {}
    output.headersArr = []

    // Parse headers
    var header
    for (var i = lines.length; i--;) {
      header = this.parseHeaderLine(lines[i])

      output.headersArr.push(header)
      output.headersObj[header.name] = header.value
    }

    return output
  }
840514
function headers(buffer) {
    var head = {};
    if (buffer[0] === 0x89 && buffer[1] === 0x50 && buffer[2] === 0x4E &&
        buffer[3] === 0x47 && buffer[4] === 0x0D && buffer[5] === 0x0A &&
        buffer[6] === 0x1A && buffer[7] === 0x0A) {
        head['Content-Type'] = 'image/png';
    } else if (buffer[0] === 0xFF && buffer[1] === 0xD8 &&
        buffer[buffer.length - 2] === 0xFF && buffer[buffer.length - 1] === 0xD9) {
        head['Content-Type'] = 'image/jpeg';
    } else if (buffer[0] === 0x47 && buffer[1] === 0x49 && buffer[2] === 0x46 &&
        buffer[3] === 0x38 && (buffer[4] === 0x39 || buffer[4] === 0x37) &&
        buffer[5] === 0x61) {
        head['Content-Type'] = 'image/gif';
    } else if (buffer[0] === 0x52 && buffer[1] === 0x49 && buffer[2] === 0x46 && buffer[3] === 0x46 &&
        buffer[8] === 0x57 && buffer[9] === 0x45 && buffer[10] === 0x42 && buffer[11] === 0x50) {
        head['Content-Type'] = 'image/webp';
    // deflate: recklessly assumes contents are PBF.
    } else if (buffer[0] === 0x78 && buffer[1] === 0x9C) {
        head['Content-Type'] = 'application/x-protobuf';
        head['Content-Encoding'] = 'deflate';
    // gzip: recklessly assumes contents are PBF.
    } else if (buffer[0] === 0x1F && buffer[1] === 0x8B) {
        head['Content-Type'] = 'application/x-protobuf';
        head['Content-Encoding'] = 'gzip';
    }
    return head;
}
257922
public void doHttpPut(String url, HttpResponse result, Map<String, Object> headers, String contentType) {
        httpClient.put(url, result, headers, contentType);
    }
890385
def decode_response(response):
    
    def is_compressed(headers):
        encoding = headers.get('content-encoding', [])
        return encoding and encoding[0] in ('gzip', 'deflate')

    def decompress_body(body, encoding):
        """Returns decompressed body according to encoding using zlib.
        to (de-)compress gzip format, use wbits = zlib.MAX_WBITS | 16
        """
        if encoding == 'gzip':
            return zlib.decompress(body, zlib.MAX_WBITS | 16)
        else:  # encoding == 'deflate'
            return zlib.decompress(body)

    # Deepcopy here in case `headers` contain objects that could
    # be mutated by a shallow copy and corrupt the real response.
    response = copy.deepcopy(response)
    headers = CaseInsensitiveDict(response['headers'])
    if is_compressed(headers):
        encoding = headers['content-encoding'][0]
        headers['content-encoding'].remove(encoding)
        if not headers['content-encoding']:
            del headers['content-encoding']

        new_body = decompress_body(response['body']['string'], encoding)
        response['body']['string'] = new_body
        headers['content-length'] = [str(len(new_body))]
        response['headers'] = dict(headers)
    return response
1302902
function(xhr) {
    var response = {
        headers: {},
        statusCode: xhr.status
    };

    var headerPairs = xhr.getAllResponseHeaders().split('\u000d\u000a');
    for (var i = 0; i < headerPairs.length; i++) {
        var headerPair = headerPairs[i],
            index = headerPair.indexOf('\u003a\u0020');

        if (index > 0) {
            var key = headerPair.substring(0, index);
            var val = headerPair.substring(index + 2);
            response.headers[key.toLowerCase()] = val;
        }
    }

    return response;
}
882875
function (response) {
        var contentType = response.headers.get(HEADERS.CONTENT_TYPE),
            contentDisposition = response.headers.get(HEADERS.CONTENT_DISPOSITION),
            mimeInfo = getMimeInfo(contentType, response.stream || response.body),
            fileName = getFileNameFromDispositionHeader(contentDisposition),
            fileExtension = mimeInfo.extension,

            /**
             * @typedef Response~ResponseContentInfo
             *
             * @property {String} mimeType sanitized mime type
             * @property {String} mimeFormat format for the identified mime type
             * @property {String} charset the normalized character set
             * @property {String} fileExtension extension identified from the mime type
             * @property {String} fileName file name extracted from disposition header
             */
            contentInfo = {};


        // if file name is not present in the content disposition headers, use a default file name
        if (!fileName) {
            fileName = DEFAULT_RESPONSE_FILENAME;
            // add extension to default if present
            fileExtension && (fileName += (DOT + fileExtension));
        }

        // create a compacted list of content info from mime info and file name
        mimeInfo.mimeType && (contentInfo.mimeType = mimeInfo.mimeType);
        mimeInfo.mimeFormat && (contentInfo.mimeFormat = mimeInfo.mimeFormat);
        mimeInfo.charset && (contentInfo.charset = mimeInfo.charset);
        fileExtension && (contentInfo.fileExtension = fileExtension);
        fileName && (contentInfo.fileName = fileName);

        return contentInfo;
    }
298669
function parse (headers) {
  if (headers.slice(0,4).toLowerCase() == 'http') {
    var newlineIndex = headers.indexOf('\r\n');
    headers = headers.slice(newlineIndex + 2);
  }
  return parseHeaders(headers);
}