restlet.Response
Object Description |
An HTTP response for a RESTlet script. This object is read-only. Use restlet.createResponse(options) to create and return this object. |
Supported Script Types |
RESTlet scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2024.1 |
Syntax
Important:
The following code sample shows a basic implementation for this member. For a complete script example, see N/scriptTypes/restlet Module Script Sample.
/**
* @NApiVersion 2.1
* @NScriptType RESTlet
*/
define(['N/scriptTypes/restlet', 'N/query'],
function(restlet, query) {
const get = function (requestParams) {
const htmlResponse = restlet.createResponse({
content: '<h1>Hello World</h1>',
contentType: 'text/html'
});
log.debug({
title: 'Response Content-Type header: ',
details: htmlResponse.contentType
});
return htmlResponse;
};
return { get: get };
});