Hey! I have an issue where when I call a Suitelet...
# suitescript
n
Hey! I have an issue where when I call a Suitelet from a Client Script, it returns whatever I return from the Suitelet, but adds something like this to the call.body (at the very end):
Copy code
<!-- 722 s: 2% #12 cache: 0% #0 -->
<!-- Host [ ** ] App Version [ 2021.1.0.60 ] -->
<!-- COMPID [ ** ]  EMAIL [ ** ] URL [ /app/site/hosting/scriptlet.nl ] Time [ Mon May 03 12:50:35 PDT 2021 ] -->
<!-- Not logging slowest SQL -->
Has anybody seen this and knows why it behaves like this and how to exclude it?
w
If you don't specify the response type and the response contains < or >, Netsuite will set response type to HTML and add that piece of info.
👍 1
n
@Watz thanks, interesting, never seen this before, probably never missed writing response type then. Are we talking about the Content-Type header?
w
Yeah, if I recall correctly.
Don't recall exactly... Just make sure you tell netsuite that the response is json/data
n
@Watz I added the following to the scriptcontext.response in the Suitelet:
Copy code
scriptContext.response.setHeader({
                    name: 'Content-Type',
                    value: 'application/json',
                });
Worked like a charm. Thanks a lot! 🙂
👍 1