I am using nlapiRequestURL to call a remote site requiring basic authorization like this:
headers['Authorization'] = 'Basic YWRtaW46MTIzNA=='; var myresponse = nlapiRequestURL("http://www.myremoteserver.com", null, headers); Authentication seems to have worked, I can get the results from the remote server. However, I found myresponse.getBody() return the following: Authorization: Basic YWRtaW46MTIzNA== User-Agent: NetSuite/2012.1 (SuiteScript) Host: www.myremoteserver.com Body Text from myremoteserver
It appears to me, it's prepending request headers to the response body. Without authentication, by commenting out // headers['Authorization'] = 'Basic YWRtaW46MTIzNA=='; line, getBody() returns only - expected behavior Body Text from myremoteserver
Is it a bug in nlapiRequestURL? Any workaround? I was thinking to split the body from headers, but there doesn't appear to be an empty line, so I am not sure how to split the "body".Thanks in advance.Ray