HTTP module
Requests and responses
// Get the HTML content from novacura.com as text
return HTTP.request("https://www.novacura.com").asText();Request options
method
// Make a HEAD request and return the status code
return HTTP.request("https://www.novacura.com", { method: "HEAD" }).statusCode;body
// Make a POST request with a text body (serialized JSON)
let response = HTTP.request(
'https://jsonplaceholder.typicode.com/posts',
{
method: 'POST',
body: JSON.serialize({
title: 'foo',
body: 'bar',
userId: 1,
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
});
return response.asText();
headers
continueOnError
Responses
statusCode
reasonPhrase
ok
headers
asText
asBinary
close
Multipart content
Legacy HTTP module functions
getText
getBinary
postText
postBinary
patchText
patchBinary
putText
putBinary
head
delete
Last updated
Was this helpful?