Somebody knows what would be the difference betwee...
# suitescript
a
Somebody knows what would be the difference between https*.request* and https*.get??? @battk?*
s
I don't have the docs in front of me, but typically
request
would let you specify the HTTP verb, where as
get
means HTTP GET
a
Well yes, I can see that in the docs, but technically what would be the difference? we already had https.get and https.post...
b
request
would be for using methods such as HEAD, CONNECT, OPTIONS, TRACE, or PATCH https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
You could also use it to simplify something like this
Copy code
if (method === https.Method.GET)
  https.get({...});
else if (method === <http://https.Method.POST|https.Method.POST>)
  <http://https.post|https.post>({...});
else if (method === https.Method.DELETE)
  https.delete({...});
to something like
Copy code
https.request({method, ...});
b
no huge difference, request is more generic get is implemented as
Copy code
get: function get(config, headers, httpClient)
                       {
                           checkConfig(config);
                           if (!utilityFunctions.isObject(config))
                           {
                               var url = config;
                               config = {url: url, headers: headers || null};
                           }
                           config.method = this.Method.GET;
                           return this.request(config, httpClient);
                       }
the get is just a convenience method for a request
b
message has been deleted
😆 1
🙂 1
😕 1