I have to retrieve the Github pull request, using the url:
https://api.github.com/repos/<user>/<repo>/pulls/<pr_number>
and the repo
https://api.github.com/repos/<user>/<repo>
I tried to use Octokit.js
-> https://github.com/octokit/core.js#readme
as is suggested in the Github documentation. I am using the next code:
pm.sendRequest("https://cdnjs.cloudflare.com/ajax/libs/rest.js/15.2.6/octokit-rest.js", (err, res) => {
pm.collectionVariables.set("octokit", res.text());
eval(pm.collectionVariables.get("octokit"));
// eval will evaluate the JavaScript code and intialize the min.js
})
But it seems like it is not the correct way to use the octokit
library in Postman. I got the next error:
There was an error in evaluating the Pre-request Script:Error: window is not defined
I followed the next approach to import external libraries in Postman, using a Pull a library from CDN approach
https://blog.postman.com/adding-external-libraries-in-postman/
am I missing something?