Good Morning, Do you know when you do an https req...
# suitescript
k
Good Morning, Do you know when you do an https requestion for a image file in file cabinet is the body of the request utf-8 or base64. I am going to use the N/encode module to convert the string to base64
c
Do you mean when you request it using the URL that’s on the file record? If so, it’ll be binary. Whenever you’re wanting to know something like this you can just look at the request headers in your browser dev tools to see the content type etc.
k
Yes I am using the url to request the image but I need it returned as a base64 string
b
its actually entirely dependent on the server you make a request to
if the content type header matches the list that netsuite counts as binary, its base 64 encoded
if its not, its utf-8 plaintext, at which point the body its probably useless to you because of the encoding errors
you really want to use N/file instead of N/https if you are getting something out of the file cabinet
it will do the same thing for base64 vs plaintext, but its less likely to mess up on the content type