Can someone please let me know why the response is difference when calling the create pull request API using node.js vs curl is different?
Hi there, @johnsonsamuel !
One possible reason the responses are different despite making the same call to the GitHub API is because they are two different client libraries with their own implementation details. It’s likely that
node-fetch omits certain fields while keeping others unless otherwise specified. It’s not something I can confidently speak on since it’s not something GitHub built nor currently maintains, though it may be worthwhile to ask the project maintainers about this in an issue.
Speaking to the GitHub API portion of this, that
422 Unprocessable Entity is one of our documented
Client errors when invalid fields are sent.
Given that error message––
"A pull request already exists for owner:branchName"––my guess is that this request attempted to create another pull request for the same
head branch for an existing pull request. Here are some approaches that might help:
- close the existing pull request
- create a pull request specifying a different
I hope this helps, though I’m sure others in the Support Community may have other approaches to share!