gd-sprest 9.7.9 → 9.8.1

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/build/rest.js CHANGED
@@ -6,7 +6,7 @@ import { GraphTypes, SPTypes } from "./sptypes";
6
6
  * SharePoint REST Library
7
7
  */
8
8
  export const $REST = {
9
- __ver: 9.79,
9
+ __ver: 9.81,
10
10
  AppContext: (siteUrl) => { return Lib.Site.getAppContext(siteUrl); },
11
11
  Apps: Lib.Apps,
12
12
  ContextInfo: Lib.ContextInfo,
@@ -34,7 +34,22 @@ export class XHRRequest {
34
34
  // Flag indicating the request has completed
35
35
  get completedFl() { return this.xhr ? this.xhr.readyState == 4 : false; }
36
36
  // Gets a response header
37
- getResponseHeader(key) { return this.xhr ? this.xhr.getResponseHeader(key) : ""; }
37
+ getResponseHeader(key) {
38
+ // Ensure the a response exists
39
+ if (this.xhr == null) {
40
+ return null;
41
+ }
42
+ // See if the xml http request was used
43
+ if (this.xhr.getResponseHeader) {
44
+ return this.xhr.getResponseHeader(key);
45
+ }
46
+ // See if the fetch command was used
47
+ if (this.xhr["headers"]) {
48
+ return this.xhr["headers"].get(key);
49
+ }
50
+ // Return null by default
51
+ return null;
52
+ }
38
53
  // The response
39
54
  get response() { return this.xhr ? this.xhr.response : null; }
40
55
  // The xml http request
@@ -43,16 +58,12 @@ export class XHRRequest {
43
58
  get requestData() { return this.targetInfo.requestData; }
44
59
  // Return the rate limit information
45
60
  get rateLimit() {
46
- // Ensure the rate limit information exists
47
- if (this.xhr == null || this.getResponseHeader("RateLimit-Limit") == null) {
48
- return null;
49
- }
50
61
  // Return the rate limit information
51
- return {
62
+ return this.getResponseHeader("RateLimit-Limit") ? {
52
63
  limit: this.getResponseHeader("RateLimit-Limit"),
53
64
  remaining: parseInt(this.getResponseHeader("RateLimit-Remaining")),
54
65
  reset: parseInt(this.getResponseHeader("RateLimit-Reset"))
55
- };
66
+ } : null;
56
67
  }
57
68
  // The request headers
58
69
  get requestHeaders() { return this.headers; }