suitedev
08/22/2024, 7:28 PMChanges to Default Content-Type Header of RESTlet HTTP Responses
You are receiving this notification because your NetSuite account has one or more RESTlet scripts that return HTML content. This notification is to inform you that the behavior of these scripts is targeted to change as of September 30, 2024.
...
If your RESTlet scripts are locked or belong to a SuiteApp, contact the SuiteApp owner. If it's a NetSuite SuiteApp, contact NetSuite Customer Support for assistance.
What is Changing?
Currently, any RESTlet script that returns HTML content is determined by the Content-Type header in the HTTP request. If the Content-Type header of the HTTP request has a value, the value gets passed to the HTTP response. If there is no Content-Type header defined in the HTTP request, the default value of the HTTP response Content-Type header is HTML (or text/html).
As of September 30, 2024, any RESTlet script that does not have a defined HTTP request Content-Type header will have a default HTTP response Content-Type header of plain text (or text/plain).
Required Actions
If you require any RESTlet scripts to have a return value in HTML format, you must update these scripts, otherwise the text/plain content type is preferred to avoid injection issues. Use the new N/scriptTypes/restlet module to set the RESTlet's HTTP response Content-Type header to text/html explicitly. Failure to update these scripts before September 30, 2024 will render your RESTlet responses as plain text instead of HTML after this date.
See the following code sample for the updated RESTlet implementation:BeforeAfter
/**
* BEFORE
* @NApiVersion 2.1
* @NScriptType restlet
*/
define([], () => {
return {
get() {
return "<b>Hello World</b>,
from restlet!";
},
};
/**
* AFTER
* @NApiVersion 2.1
* @NScriptType restlet
*/
define(["N/scriptTypes/restlet"], (restlet) => {
return {
get() {
return restlet.createResponse({
contentType: "text/html",
content: "<b>Hello World</b>,
from restlet!"
});
},
};
});
For more information about how to use the new N/scriptTypes/restlet module in your RESTlet scripts, see Help Topic N/scriptTypes/restlet Module.suitedev
08/22/2024, 7:31 PMsuitedev
08/22/2024, 7:38 PMsuitedev
08/22/2024, 7:38 PMTim Chapman
08/22/2024, 7:41 PM