我有这个curl命令发送带身份验证的api请求。我正在使用空中编写测试,我需要在测试中发送api请求。卷曲命令
curl https://example.com/api/v2 / …
-u option将基本身份验证头发送到客户端。
-u
最顶层的 README 的 空降 显示如何发送auth标头:
README
describe 'Test to GET' do it 'should get the existing data' do get "https://example.com/api/v2/tests.json", { 'x-auth-token' => 'my_token' } expect_status(200) end end
如何获得令牌 user : password 我作为家庭作业离开你(例如,你可能只是记录 curl 请求。)
user
password
curl
您也可以通过全局设置auth标头 空降 配置 。