MrRefactoring / jira.js

A JavaScript/TypeScript wrapper for the JIRA Cloud, Service Desk and Agile REST API
https://mrrefactoring.github.io/jira.js/
MIT License
366 stars 49 forks source link

fix(bugfix): SendCustomHeaderForAddAttachmentApi as per the jira api … #152

Closed balaprasanna closed 3 years ago

balaprasanna commented 3 years ago

Hi @MrRefactoring and Team,

As per the JIRA Api doc, We need to pass a custom header for Attachment api. (adding a new attachment to an issue) https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post

'X-Atlassian-Token': 'no-check'

Issue: Without this header, currently the post request received error like XSRF check failed

Similar issues reported: https://ecosystem.atlassian.net/browse/ACJIRA-317

Please review the PR. Thanks

MrRefactoring commented 3 years ago

Hi @balaprasanna! Thanks for your PR. Why using noCheckAtlassianToken: true not suitable for you?

const config = {
  host: '...',
  noCheckAtlassianToken: true,
};
MrRefactoring commented 3 years ago

I looked again at the Jira Cloud API specification for issue attachments and saw that this token is mandatory, so I'm adding this to the master branch. Thanks for the PR!

balaprasanna commented 3 years ago

Thanks @MrRefactoring.