Methods for the Response Object

The following methods are available for the EdgeWorkers response objects.

getHeader(name) Returns an array of header values by header name. The header names are case insensitive. If the header doesn’t exist, an empty string is returned.
// Content-Length: 100
response.getHeader('Content-Length')[0]
// => "100"
setHeader(name, value) Sets header values and replaces previous ones. Define the new header name. The value can be a single string or an array.
// Powered-By: bar
response.setHeader('Powered-By','foo')
// Powered-By: foo 
addHeader(name, value) Adds names and values to a header. If the header already exists, the name and value are appended. The value can be a single string or an array.
//
response.addHeader('Powered-By','foo')
// Powered-By: foo 

// Powered-By: bar
response.addHeader('Powered-By','foo')
// Powered-By: foo 
// Powered-By: bar
removeHeader(name) Removes the named header. The header name is case insensitive.
// Debug: foo
response.removeHeader('Debug')
//