Search.../

headers

Sets or gets the HTTP response header fields.

Description

The headers property contains an object of key:value pairs where the key is the header field name and the value is the header field value.

When defining a content-type key, note that for Free sites,text/html is not supported. Premium sites support all content types.

Type:

ObjectRead & Write

Was this helpful?

Get the response headers

Copy Code
1// In http-functions.js
2
3export function use_myFunction(request) {
4
5 let headers = response.headers;
6
7 /* headers:
8 * {
9 * "content-type": "application/json",
10 * "last-modified": "Tue, 26 Sep 2017 00:00:00 GMT"
11 * }
12 */
13
14}
Set the response headers

Copy Code
1// In http-functions.js
2
3export function use_myFunction(request) {
4
5 const headers = {
6 "content-type": "application/json",
7 "last-modified": "Tue, 26 Sep 2017 00:00:00 GMT"
8 };
9
10 response.headers = headers;
11
12}