Skip to content

Commit

Permalink
Swap form-data for formdata-node (#333)
Browse files Browse the repository at this point in the history
The newer library better supports modules and is written in TypeScript.
The FormData interface is a drop-in replacement except for getHeaders(),
but that didn't do anything useful, so it can be dropped.

Closes #327

Signed-off-by: Matyáš Kroupa <[email protected]>
Co-authored-by: Matyáš Kroupa <[email protected]>
Co-authored-by: Vladislav Tupikin <[email protected]>
  • Loading branch information
3 people authored Jan 2, 2025
1 parent df8e9d2 commit a650eb1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"vitest": "^2.1.8"
},
"dependencies": {
"axios": "^1.7.9",
"form-data": "^4.0.1",
"tslib": "^2.8.1"
"axios": "^1.7.7",
"formdata-node": "^6.0.3",
"tslib": "^2.7.0"
}
}
3 changes: 1 addition & 2 deletions src/serviceDesk/serviceDesk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as FormData from 'form-data';
import { FormData } from 'formdata-node';
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
Expand Down Expand Up @@ -124,7 +124,6 @@ export class ServiceDesk {
headers: {
'X-Atlassian-Token': 'no-check',
'Content-Type': 'multipart/form-data',
...formData.getHeaders?.(),
},
data: formData,
};
Expand Down
4 changes: 1 addition & 3 deletions src/version2/issueAttachments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @ts-expect-error Wrong form data typings
import FormData from 'form-data';
import { FormData } from 'formdata-node';
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
Expand Down Expand Up @@ -434,7 +433,6 @@ export class IssueAttachments {
headers: {
'X-Atlassian-Token': 'no-check',
'Content-Type': 'multipart/form-data',
...formData.getHeaders?.(),
},
data: formData,
maxBodyLength: Infinity,
Expand Down
4 changes: 1 addition & 3 deletions src/version3/issueAttachments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @ts-expect-error Wrong form data typings
import FormData from 'form-data';
import { FormData } from 'formdata-node';
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
Expand Down Expand Up @@ -434,7 +433,6 @@ export class IssueAttachments {
headers: {
'X-Atlassian-Token': 'no-check',
'Content-Type': 'multipart/form-data',
...formData.getHeaders?.(),
},
data: formData,
maxBodyLength: Infinity,
Expand Down

0 comments on commit a650eb1

Please sign in to comment.