Skip to content

Commit 11f3d2c

Browse files
authored
Merge pull request #32 from microsoftgraph/odata-no-dollar-support
Support OData params without $ prefix and test cases
2 parents 0a57f8b + 155e56e commit 11f3d2c

File tree

8 files changed

+19
-6
lines changed

8 files changed

+19
-6
lines changed

lib/graph-js-sdk-web.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,10 @@ exports.ResponseHandler = ResponseHandler;
364364

365365
},{}],4:[function(require,module,exports){
366366
"use strict";
367-
exports.oDataQueryNames = ["$select", "$expand", "$orderby", "$filter", "$top", "$skip", "$skipToken", "$count"];
367+
exports.oDataQueryNames = ["select", "expand", "orderby", "filter", "top", "skip", "skipToken", "count"];
368368
exports.DEFAULT_VERSION = "v1.0";
369369
exports.GRAPH_BASE_URL = "https://graph.microsoft.com/";
370+
exports.oDataQueryNames = exports.oDataQueryNames.concat(exports.oDataQueryNames.map((s) => "$" + s));
370371

371372
},{}],5:[function(require,module,exports){
372373
"use strict";

lib/src/common.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export declare const oDataQueryNames: string[];
1+
export declare let oDataQueryNames: string[];
22
export declare const DEFAULT_VERSION = "v1.0";
33
export declare const GRAPH_BASE_URL = "https://graph.microsoft.com/";
44
export interface AuthProviderCallback {

lib/src/common.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/test/urlParsing.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/test/urlParsing.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
export const oDataQueryNames = ["$select", "$expand", "$orderby", "$filter", "$top", "$skip", "$skipToken", "$count"];
1+
export let oDataQueryNames = ["select", "expand", "orderby", "filter", "top", "skip", "skipToken", "count"]
22
export const DEFAULT_VERSION = "v1.0";
33
export const GRAPH_BASE_URL = "https://graph.microsoft.com/";
44

5+
// support oData params with and without $ prefix
6+
oDataQueryNames = oDataQueryNames.concat(oDataQueryNames.map((s) => "$"+s));
7+
58
export interface AuthProviderCallback {
69
(error: any, accessToken: string): void
710
}

test/urlParsing.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ let testCases = {
1717
"/me?a=b": "https://graph.microsoft.com/v1.0/me?a=b",
1818
"/me?$filter=b&c=d": "https://graph.microsoft.com/v1.0/me?$filter=b&c=d",
1919
"me?$filter=b&c=d": "https://graph.microsoft.com/v1.0/me?$filter=b&c=d",
20+
21+
// oData params should work with and without $
22+
"me?$select=displayName": "https://graph.microsoft.com/v1.0/me?$select=displayName",
23+
"me?select=displayName": "https://graph.microsoft.com/v1.0/me?select=displayName",
24+
"https://graph.microsoft.com/beta/me?select=displayName": "https://graph.microsoft.com/beta/me?select=displayName"
2025
}
2126

2227
describe('#parsePath()', function() {

0 commit comments

Comments
 (0)