MunifTanjim / node-bitbucket

Bitbucket API client for Browser and Node.js
https://bitbucketjs.netlify.app
MIT License
105 stars 31 forks source link

Location header not returned after mergePullRequest #103

Open mattiaerli97 opened 3 years ago

mattiaerli97 commented 3 years ago

I have to merge a pull request and get the "Location" header so I can retrieve the correct task-status using Bitbucket API. However, when I merge a pull request, after a success code is returned (merge works correctly), I don't receive the expected header. In particular, performing the call reported below:

state.bb.repositories
        .mergePullRequest({
          workspace: WORKSPACE,
          repo_slug: data.slug,
          pull_request_id: data.pr_id,
          async: true,
        })
        .then(({ resp, headers }) => {
          console.log(headers)
        })

In the console.log used in the promise function, I receive the following headers:

cache-control: "no-cache, no-store, must-revalidate, max-age=0"
content-length: "2"
content-type: "application/json; charset=utf-8"
expires: "Fri, 09 Jul 2021 14:27:22 GMT"

So no "Location" header is returned. Can you please explain me why or/and the correct syntax to get the "Location" header? Thanks a lot

MunifTanjim commented 2 years ago

If you make the request directly to this API: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/merge#post does it returns the Location header? I know it's written the their documentation. But in many case those documentations are not correct or not up-to-date.