-
Notifications
You must be signed in to change notification settings - Fork 27
Description
when an invalid apiKey is sent to the query request of rally api, request.js file in dist folder of rally is throwing unhandled exception.
Below is the code in request.js => dorequestPromise =>
var result = _lodash2.default.values(body)[0];
if (result.Errors.length) {
reject(generateError(result.Errors));
} else {
resolve(result);
}
value of body variable:
{
message:null
status:'401'
url:'/slm/webservice/v2.0/userpermission'
}
so when the values of [0] is being picked, result is containing null and the next line trying to check Errors length on null is throwing exception.
Below is my code / repro code
restApi = rally({
apiKey: apikey, // invalid apikey
apiVersion: "v2.0",
server: "https://rally1.rallydev.com",
requestOptions: {
headers: {
"X-RallyIntegrationName": //correct value which work well with valid apikey
"X-RallyIntegrationVendor": //correct value which work well with valid apikey
"X-RallyIntegrationVersion": "1.0",
}, proxy: proxy //correct value which work well with valid apikey
,jar: true
}
});
restApi.query({
type: 'userpermission', //the type to query
start: 1, //the 1-based start index, defaults to 1
pageSize: 200, //the page size (1-200, defaults to 200)
limit: Infinity, //the maximum number of results to return- enables auto paging
fetch: ['Workspace', 'Name', 'Project', 'ObjectID', 'User'], //the fields to retrieve
scope: {}
}, function (error, result) {
})