Add Attachment api is not working after first request

Viewed 21

I have integrated JIRA rest APIs for issue creation in nodejs. On first time the APIs are working fine, but when submitting the form again to create a new issue, issue create API is working fine but add attachment API is not giving response. Below is the request config:

{ method: 'post',
  url:
   'https://smargtech.atlassian.net/rest/api/2/issue/10140/attachments',
  headers:
   { Authorization:
      'Basic c2h1YmhhbS5tYWhlc2h3YXJpQHNyc3ZhbHV0ZWNoLmNvbTpwQjVTM3JyUThwVkN5azR4N2NGejNBOTU=',
     'X-Atlassian-Token': 'nocheck' },
  data:
   FormData {
     _overheadLength: 1080,
     _valueLength: 0,
     _valuesToMeasure:
      [ [ReadStream],
        [ReadStream],
        [ReadStream],
        [ReadStream],
        [ReadStream],
        [ReadStream] ],
     writable: false,
     readable: true,
     dataSize: 0,
     maxDataSize: 2097152,
     pauseStreams: true,
     _released: true,
     _streams:
      [ '----------------------------196132646791726646510801\r\nContent-Disposition: form-data; name="file"; filename="Screenshot from 2022-09-13 11-24-24.png"\r\nContent-Type: image/png\r\n\r\n',
        [DelayedStream],
        [Function: bound ],
        '----------------------------196132646791726646510801\r\nContent-Disposition: form-data; name="file"; filename="Screenshot from 2022-09-13 11-24-43.png"\r\nContent-Type: image/png\r\n\r\n',
        [DelayedStream],
        [Function: bound ],
        '----------------------------196132646791726646510801\r\nContent-Disposition: form-data; name="file"; filename="Screenshot from 2022-09-19 14-33-55.png"\r\nContent-Type: image/png\r\n\r\n',
        [DelayedStream],
        [Function: bound ] ],
     _currentStream: null,
     _insideLoop: false,
     _pendingNext: false,
     _boundary: '--------------------------196132646791726646510801',
     _events:
      [Object: null prototype] { error: [Function: handleStreamError] },
     _eventsCount: 1 } }
0 Answers
Related