相关疑难解决方法(0)

邮递员:你如何删除预请求脚本中的cookie?

我见过的所有邮递员cookie管理答案都指的是浏览器扩展(打开chrome,删除cookies即拦截器等)或应用程序,使用UI手动管理cookie.

我想删除我的预请求代码中的某些cookie,作为编写API测试脚本的一部分.(以编程方式删除它们)

Sandobx API文档提到 pm.cookies我尝试过

if (pm.cookies !== null) {
   console.log("cookies!");
   console.log(pm.cookies);
}
Run Code Online (Sandbox Code Playgroud)

pm.cookies阵列是空的.然而在控制台中,GET调用然后传递cookie.

还有postman.getResponseCookies,这是null(我假设因为我们在预请求部分,而不是在测试部分)

一个答案建议调用postman-echo服务来删除cookie.我还没有对此进行调查,但感觉不对.

cookies session-cookies postman

18
推荐指数
2
解决办法
7095
查看次数

请求来自 Postman,但不是来自 cURL

我有一个非常简单的 Postman 请求,它在 Postman 中运行良好。这只是对以下 URL 的 GET 请求:

http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude&longitude&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false

如果我要求 Postman 为我发出一个 cURL 请求,它会给我以下信息:

curl -X GET \ 'http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude=&longitude=&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false' \ -H 'cache-control: no-cache' \ -H 'postman-token: b4ae79c0-c3f0-8247-8c2f-306c43376039'

结果是它永远挂起,从不给我任何回应。

知道如何才能使 cURL 请求正常工作吗?

curl postman

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

postman ×2

cookies ×1

curl ×1

session-cookies ×1