diff --git a/src/jira.js b/src/jira.js index e9af3165..ee47ac31 100644 --- a/src/jira.js +++ b/src/jira.js @@ -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}` + }))); + } } diff --git a/test/jira-tests.js b/test/jira-tests.js index 483caa36..676a44ac 100644 --- a/test/jira-tests.js +++ b/test/jira-tests.js @@ -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'); + }); }); });