I'm trying to output (proxying) a PDF that is stor...
# suitescript
p
I'm trying to output (proxying) a PDF that is stored on a third party server, via SuiteScript. It's SS 1.0 so far because it's SCA and 99% of SCA is SS 1.0. The API responds with a raw file (not base64 encoded), which i store on a variable and send in nlobjResponse I can't make it work. the PDF comes blank. If i compare the file downloaded from POSTMAN vs the file, i can see inside that the content is similar in A-Z chars, but not in any other chars. Any insights?
b
you are generally doomed if you dont receive base 64 in the response body
netsuite tries to interpret it as utf8 and the encoding errors will destroy binary files
p
That's what i suspected. Is this also true with SS2?
b
yes
p
Thanks. To make it worse, this api sends "text/html" as content-type 😄
facepalm It's definitely the api sending the wrong content type. If i download the pdf and i host the file in another server that serves static files with the correct content types, it works just fine.