Skip to content

Commit b07f39f

Browse files
2.0.5 (#110)
* endpoint types changed * type definition changed * version 2.0.1 * changelog added * issueTypeIds fixed * models types changed * - `Buffer.from` replaced to raw JS code in Basic authorization - Telemetry config type fixed - `noCheckAtlassianToken` flag added to config - Typing improves * tests added * The principles of running linter have been changed * 2.0.2 RC * API updates * Add attachment API fixed (#106) * Error with attachment fixed * Max one github action in parallel * GitHub actions: create .env file * Action syntax fix * linter fixes * 2.0.3 * .npmignore fixed * addAttachment capability for browsers * Fixed error with getHeaders function call in addAttachment method * Fixed error with addAttachment method call in browsers * 2.0.5
1 parent c0aefc4 commit b07f39f

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Jira.js changelog
22

3+
### 2.0.5
4+
5+
- addAttachment fixed for browsers
6+
37
### 2.0.4
48

59
- addAttachment fixed for browsers

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jira.js",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"main": "out/index.js",
55
"types": "out/index.d.ts",
66
"repository": "https://github.com/MrRefactoring/jira.js.git",

src/clients/baseClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ export class BaseClient implements Client {
8484
bodyExists: !!requestConfig.data,
8585
callbackUsed: !!callback,
8686
headersExists: !!requestConfig.headers,
87-
libVersion: '2.0.4',
88-
libVersionHash: 'ae7751b937849ebaab9d7c5000532148',
87+
libVersion: '2.0.5',
88+
libVersionHash: 'b559db93c279b7e4886705cb45f7ca9c',
8989
methodName: telemetryData?.methodName || 'sendRequest',
9090
onErrorMiddlewareUsed: !!this.config.middlewares?.onError,
9191
onResponseMiddlewareUsed: !!this.config.middlewares?.onResponse,

src/version2/issueAttachments.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,11 @@ export class IssueAttachments {
208208
const config = {
209209
url: `/rest/api/2/issue/${parameters.issueIdOrKey}/attachments`,
210210
method: 'POST',
211-
headers: formData.getHeaders(),
212-
data: formData.getBuffer(),
211+
headers: {
212+
'Content-Type': 'multipart/form-data',
213+
...formData.getHeaders?.(),
214+
},
215+
data: formData,
213216
} as RequestConfig;
214217

215218
return this.client.sendRequest(config, callback, { methodName: 'version2.issueAttachments.addAttachment' });

src/version3/issueAttachments.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,11 @@ export class IssueAttachments {
208208
const config = {
209209
url: `/rest/api/3/issue/${parameters.issueIdOrKey}/attachments`,
210210
method: 'POST',
211-
headers: formData.getHeaders(),
212-
data: formData.getBuffer(),
211+
headers: {
212+
'Content-Type': 'multipart/form-data',
213+
...formData.getHeaders?.(),
214+
},
215+
data: formData,
213216
} as RequestConfig;
214217

215218
return this.client.sendRequest(config, callback, { methodName: 'version3.issueAttachments.addAttachment' });

tests/system/utils/createTestProject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const createTestProject = async () => {
1010
leadAccountId: '5b6d7f20e6dba529eefdbad9',
1111
projectTypeKey: 'software',
1212
}).catch((error) => {
13-
console.error(error.response.data);
13+
console.error(error.response?.data ?? error);
1414
throw error;
1515
});
1616
};

0 commit comments

Comments
 (0)