列出Postman的预定书中的GitHub API列出拉的请求

发布于 2025-02-11 01:03:37 字数 983 浏览 1 评论 0原文

我必须使用url:

https://api.github.com/repos/repos/&user&user&user>/pr_number> and the ggt; and the ggt; and the 我尝试

https://api.github.com/repos/<user>/<repo>

使用octokit.js - &gt; https://github.com/octokit/core.js#readme正如GitHub文档中建议的那样。我正在使用下一个代码:

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
})

但是,似乎不是在Postman中使用octokit库的正确方法。我得到了下一个错误:

There was an error in evaluating the Pre-request Script:Error: window is not defined

我遵循下一种方法在邮递员中导入外部库,使用cdn方法的拉库,

https://blog.postman.com/adding-external-libraries-in-postman/

我缺少什么吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文