What can JSMA header do for me?The JSMA header allows you to read and write the header field in requests and responses. |
The JSMA header provides the following methods:
Returns the value of key as string or null if no value is set under the key.
var acceptHeader = request.header.get("HTTP_ACCEPT"); var acceptsWebP = acceptHeader.indexOf("image/webp") > -1; |
The key to be looked up in the flexAttributes of the header
Sets the value of a specified key for the header
if (autoOptimize) { response.header.set("Vary", "Accept-Encoding,Accept"); } |
The key to be set in the flexAttributes of the header.
The value to be set for the key
Returns a list of keys from the headers.
var headerKeys = header.keys; if (headerKeys.length > 0) { for (int i = 0; i < headerKeys.length; i++) { result.push(headerKeys[i]); } } |