Skip to content

Instantly share code, notes, and snippets.

@vetsin
vetsin / Request.js
Created April 22, 2021 18:08
ServiceNow utlitiy class for making sane HTTP requests from scoped script
/*
Usage Examples and etc.:
Basic GET:
```
var request = new Request();
request.get('https://httpbin.org/get', function(hasError, response, body) {
gs.info(body);
});
/*
* Updated to support HMAC and Base64
* var CryptoJS = new Crypto().CryptoJS;
* var hash = CryptoJS.HmacSHA256('message','key');
* gs.info(hash.toString(CryptoJS.enc.Base64));
*/
var Crypto = Class.create();
Crypto.prototype = {
initialize: function() {
### Keybase proof
I hereby claim:
* I am vetsin on github.
* I am vetsin (https://keybase.io/vetsin) on keybase.
* I have a public key whose fingerprint is AFD3 1A37 1CAA 0712 DB3A 7579 2A88 FB66 00D7 FBC6
To claim this, I am signing this object: