The HTTP header fields contain the operating parameters of an HTTP request or response.
The header fields define various characteristics of the data transfer that is requested or the data that is provided in the message body.
When using nlapiRequestURL, we can use the getHeaders and getHeader method to return the header information.
Sample script:
var request = nlapiRequestURL('http://google.com');
//this will return an array of headers
var allHeaders = request.getAllHeaders();
for(var i in allHeaders)
{
//this will be the field name value can be: "Cache-Control, Code, Content-Type, etc"
var headerName = allHeaders[i] ;
//this will be the field value for each field name in the field name
var reqCount = request.getHeaders(allHeaders[i]);
}
No comments:
Post a Comment