Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added genericGet #304

Merged
merged 1 commit into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/jira.js
Original file line number Diff line number Diff line change
Expand Up @@ -2088,4 +2088,15 @@ export default class JiraApi {
query: optional,
})));
}
/** Generic Get Request
* [Jira Doc](https://docs.atlassian.com/jira-software/REST/cloud/2/)
* @name genericGet
* @function
* @param {string} endpoint - Rest API endpoint
*/
genericGet(endpoint) {
return this.doRequest(this.makeRequestHeader(this.makeUri({
pathname: `/${endpoint}`
})));
}
}
6 changes: 6 additions & 0 deletions test/jira-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1031,5 +1031,11 @@ describe('Jira API Tests', () => {
const result = await dummyURLCall('getIssueCreateMetadata', [{ expand: 'projects.issuetypes.fields' }]);
result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/createmeta?expand=projects.issuetypes.fields');
});

it('genericGet hits proper url', async () => {
// Test with field endpoint as a simple example
const result = await dummyURLCall('genericGet', ['field']);
result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/field');
});
});
});