@Moastafi74 said in load and show page using http client ?:
@Fox why doesn't load full page?
Open the console in the browser on the network tab and go to the page. You will see that multiple requests are used to load the page, not just one.
Hello guys,
is there a way to make http requests via code execution and if so how?
When I try something in BAS it always gives a parse or syntax error.
At the end I would like to make a request like this:
var filePath = [[FILE_PATH]];
var uploadUrl = [[URL]];
HTTPClient.Request({
url: uploadUrl,
method: 'PUT',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0',
'Accept': 'application/xml, text/xml, */*; q=0.01',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Content-Type': 'application/octet-stream',
'Content-Length': [[CONTENT_LENGTH]],
'Referer': 'https://xxx.com/',
'x-amz-server-side-encryption': 'AES256',
'x-amz-acl': 'private',
'Content-Disposition': 'attachment;filename="' + [[FILE_NAME]] + '"; filename*=utf-8\'\'' + [[FILE_NAME]],
'x-amz-storage-class': 'STANDARD',
'x-amz-meta-user-id': [[AMZ_UID]],
'Origin': 'https://xxx.com'
},
body: File.ReadBinary(filePath),
success: function(response) {
Log(response.body);
},
fail: function(response) {
Log('Error on upload: ' + response.body);
}
});
Thank you for helping
@basmail said in HTTP requests with javascript/npm:
Hello guys,
is there a way to make http requests via code execution and if so how?
When I try something in BAS it always gives a parse or syntax error.At the end I would like to make a request like this:
Thank you for helping
You can't send a request via "Execute code" via js like you can via the browser console. Use node js
@basmail said in HTTP requests with javascript/npm:
@Fox said in HTTP requests with javascript/npm:
You can't send a request via "Execute code" via js like you can via the browser console. Use node js
Ok, how is it done in this complex structure? There is not even a log when something fails
Use node js
@basmail said in HTTP requests with javascript/npm:
@Fox said in HTTP requests with javascript/npm:
Use node js
Yes I got that, but how is it done in node.js with this complex structure? There is not even a log when something fails...
Have you tried searching the forum for topics where users discussed sending requests from node js?