Repository: jira-node/node-jira-client (js)

Issue:
Empty properties string causing Internal Server Error on findIssue API call
On JIRA API v2, passing in an empty properties query string param is causing an Internal Server Error. Removing the param entirely or setting it to a `*` fixes the issue. url.format takes null or undefined values in the querystring and sets them to an empty string.

Changing the following line:

```javascript
properties: properties || '',
```
to

```javascript
properties: properties || '*',
```

Correctly formats the querystring and findIssue returns valid json.

Pull request:
FIX: properties key defaults to *all.
FIXES #201

This prevents the properties get parameter from being sent through as blank in the event that there are no fields specified. According to the documentation, it should use "*all", in the same way that the fields attribute does.

https://docs.atlassian.com/jira/REST/cloud/#api/2/issue

Patch:
diff --git a/src/jira.js b/src/jira.js
index 6e82102..7d78710 100644
--- a/src/jira.js
+++ b/src/jira.js
@@ -293,7 +293,7 @@ export default class JiraApi {
       query: {
         expand: expand || '',
         fields: fields || '*all',
-        properties: properties || '',
+        properties: properties || '*all',
         fieldsByKeys: fieldsByKeys || false,
       },
     })));


Test patch:
diff --git a/test/jira-tests.js b/test/jira-tests.js
index 6f7db03..0cd73d8 100644
--- a/test/jira-tests.js
+++ b/test/jira-tests.js
@@ -368,17 +368,17 @@ describe('Jira API Tests', () => {
 
     it('findIssue hits proper url', async () => {
       const result = await dummyURLCall('findIssue', ['PK-100']);
-      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=*all&properties=&fieldsByKeys=false');
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=*all&properties=*all&fieldsByKeys=false');
     });
 
     it('findIssue hits proper url with expansion', async () => {
       const result = await dummyURLCall('findIssue', ['PK-100', 'transitions,changelog']);
-      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=transitions,changelog&fields=*all&properties=&fieldsByKeys=false');
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=transitions,changelog&fields=*all&properties=*all&fieldsByKeys=false');
     });
 
     it('findIssue hits proper url with fields', async () => {
       const result = await dummyURLCall('findIssue', ['PK-100', null, 'transitions,changelog']);
-      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=transitions,changelog&properties=&fieldsByKeys=false');
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=transitions,changelog&properties=*all&fieldsByKeys=false');
     });
 
     it('findIssue hits proper url with properties', async () => {
@@ -388,7 +388,7 @@ describe('Jira API Tests', () => {
 
     it('findIssue hits proper url with fields and fieldsByKeys', async () => {
       const result = await dummyURLCall('findIssue', ['PK-100', null, 'transitions,changelog', null, true]);
-      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=transitions,changelog&properties=&fieldsByKeys=true');
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=transitions,changelog&properties=*all&fieldsByKeys=true');
     });
 
     it('getUnresolvedIssueCount hits proper url', async () => {