text 客户端服务器测试api
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 客户端服务器测试api相关的知识,希望对你有一定的参考价值。
Welcome to client01.longtailux.net.
Last login: Mon Jun 17 02:24:08 2019 from 60.241.25.182
todd@client01:~$ curl -v https://api.adorebeauty.com.au/api/nav 2>&1 | less^C
todd@client01:~$ cd /opt/projects/longtailux-clients/current
todd@client01:/opt/projects/longtailux-clients/current$ php artisan tinker
Psy Shell v0.7.2 (PHP 7.2.19-0ubuntu0.18.04.1 — cli) by Justin Hileman
>>> $nav_menu_json = 'https://api.adorebeauty.com.au/api/nav';
=> "https://api.adorebeauty.com.au/api/nav"
>>> $ch = curl_init();
=> curl resource #308
>>> curl_setopt($ch, CURLOPT_URL, $nav_menu_json);
=> true
>>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
=> true
>>> curl_setopt($ch, CURLOPT_TIMEOUT, 3);
=> true
>>> $output = curl_exec($ch);
=> """
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n
<html><head>\n
<title>403 Forbidden</title>\n
</head><body>\n
<h1>Forbidden</h1>\n
<p>You don't have permission to access /api/nav\n
on this server.<br />\n
</p>\n
</body></html>\n
"""
>>> todd@client01:~$ curl -v https://api.adorebeauty.com.au/api/nav 2>&1 | less^C
>>> curl_setopt($ch, CURLOPT_URL, $nav_menu_json);
=> true
>>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
=> true
>>> curl_setopt($ch, CURLOPT_TIMEOUT, 3);
=> true
>>> $output = curl_exec($ch);
=> """
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n
<html><head>\n
<title>403 Forbidden</title>\n
</head><body>\n
<h1>Forbidden</h1>\n
<p>You don't have permission to access /api/nav\n
on this server.<br />\n
</p>\n
</body></html>\n
"""
>>>
以上是关于text 客户端服务器测试api的主要内容,如果未能解决你的问题,请参考以下文章
如何测试客户端代码是不是正确超时 API 请求到外部服务器
在 Vue 3 中使用 Jest 测试 Apollo 客户端 API(组合 API)
text 安卓中使用MockWebServer测试API
text 测试api控制器
api测试用例(编写思路)
开源测试工具 美团琴鸟 Lyrebird 工具 (接口 mock 类)