Say I have "service" returning a XML document:
function doGet() {
var result = '<result>42</result>';
var output = ContentService.createTextOutput(result);
output.setMimeType(ContentService.MimeType.XML);
return output;
}
By default, the HTTP status code for the response will be 200. How can I set it something different, say 500 (while still returning the same XML document)?
As defined on cloud.google.com, a service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs. Typically, service accounts are used in scenarios such as: Running workloads on virtual machines (VMs).
To add an HTML file to your Apps Script project, open the Script Editor and choose File > New > HTML File. Within the HTML file, you can write most standard HTML, CSS, and client-side JavaScript. The page will be served as HTML5, although some advanced features of HTML5 are not available, as explained in Restrictions.
This is not currently possible with the ContentService. Implicitly, only the 200 status code can be returned back by the successfully completion of the script. Other error codes are all system level that get raised when something goes wrong.
If you have a good use case for this, please open a feature request in the issue tracker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With