ServerRequest.headers

Note:

The content in this help topic pertains to SuiteScript 2.0.

Property Description

The header information included in the http call. This object represents a series of name:value pairs. Each pair represents a request header name and its value.

Typically, this object encapsulates two iterations of each header name: one in lower case and another in title case. This behavior is designed so that you can use either lower case or title case when you reference a header. However, the existence of title-case iterations of header names is not guaranteed. For best results, refer to header names using all lower-case letters (and hyphens, when applicable). If you use custom headers, make sure the names of these headers do not contain underscores.

Important:

The request headers and their values are subject to change. If you use these headers in your scripts, you are responsible for testing them to make sure that they contain the information you need. For example, when making an HTTP call to a Suitelet, some headers might be filtered out. Filtering can occur if the headers affect how NetSuite processes the request internally. These filtered headers are not available to the Suitelet, so you should test to see whether a header was filtered out. If so, use a different header instead.

For more information, see HTTP Header Information.

Type

Object (read-only)

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/http Module

Parent Object

http.ServerRequest

Sibling Object Members

ServerRequest Object Members

Since

2015.2

Errors

Error Code

Thrown If

READ_ONLY_PROPERTY

You attempted to edit this property. This property is read-only.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/http Module Script Samples.

          // Add additional code 
...
log.debug({
    title: 'Server Request Headers',
    details: request.headers
});
...
// Add additional code 

        

Related Topics

http.ServerRequest
HTTP Header Information
N/http Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices