Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The JSMA header provides the following methods:

string header.get(key)

Looks up a key in the headersReturns the value of key as string or null if no value is set under the key.

Example

Code Block
languagejs
linenumberstrue
var acceptHeader = request.header.get("HTTP_ACCEPT");
var acceptsWebP = acceptHeader.indexOf("image/webp") > -1;

Parameter key:string (required)

The key to look up.be looked up in the flexAttributes of the header

void header.set(key, value)

Sets the value of a specified key in for the headers.header

Example

Code Block
languagejs
linenumberstrue
if (autoOptimize) {
  response.header.set("Vary", "Accept-Encoding,Accept");
}

Parameter key:string (required)

The key which will to be set in the flexAttributes of the header.

Parameter value:string (required)

The value to be set .for the key

string[] header.keys

Returns a list of keys from the headers.

...