glitch-javascript-sdk 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -15624,9 +15624,11 @@ var Requests = /** @class */ (function () {
15624
15624
  if (fileData) {
15625
15625
  headers['Content-Type'] = 'multipart/form-data';
15626
15626
  }
15627
+ var uri = "".concat(this.baseUrl).concat(url);
15628
+ var validUri = uri.replace(/\/\//g, '/');
15627
15629
  var axiosPromise = axios({
15628
15630
  method: method,
15629
- url: "".concat(this.baseUrl).concat(url),
15631
+ url: validUri,
15630
15632
  data: fileData || data,
15631
15633
  headers: headers,
15632
15634
  });
@@ -17246,6 +17248,29 @@ var Waitlists = /** @class */ (function () {
17246
17248
  return Waitlists;
17247
17249
  }());
17248
17250
 
17251
+ var Parser = /** @class */ (function () {
17252
+ function Parser() {
17253
+ }
17254
+ /**
17255
+ * To be used inside a catch close, this function will parse out any JSON in a error response from the api.
17256
+ *
17257
+ * @param error The Error object from the catch clause
17258
+ *
17259
+ * @returns Either returns a JSON object or false.
17260
+ */
17261
+ Parser.parseJSONFromError = function (error) {
17262
+ var errorString = error.toString();
17263
+ errorString = errorString.replace('Error: ', '');
17264
+ try {
17265
+ return JSON.parse(errorString);
17266
+ }
17267
+ catch (e) {
17268
+ return false;
17269
+ }
17270
+ };
17271
+ return Parser;
17272
+ }());
17273
+
17249
17274
  //Configuration
17250
17275
  var Glitch = /** @class */ (function () {
17251
17276
  function Glitch() {
@@ -17261,6 +17286,10 @@ var Glitch = /** @class */ (function () {
17261
17286
  Teams: Teams,
17262
17287
  Waitlists: Waitlists
17263
17288
  };
17289
+ Glitch.util = {
17290
+ Requests: Requests,
17291
+ Parser: Parser
17292
+ };
17264
17293
  return Glitch;
17265
17294
  }());
17266
17295