8
我使用supertest發送獲取查詢字符串參數,我該怎麼做?如何使用supertest發送查詢字符串參數?
我試圖
var imsServer = supertest.agent("https://example.com");
imsServer.get("/")
.send({
username: username,
password: password,
client_id: 'Test1',
scope: 'openid,TestID',
response_type: 'token',
redirect_uri: 'https://example.com/test.jsp'
})
.expect(200)
.end(function (err, res) {
// HTTP status should be 200
expect(res.status).to.be.equal(200);
body = res.body;
userId = body.userId;
accessToken = body.access_token;
done();
});
,但沒有發送參數username
,password
,client_id
作爲查詢字符串到端點。有沒有辦法使用supertest發送查詢字符串參數?
自述文件中沒有提及這個簡單函數有多愚蠢。讓我想知道我是否誤解了超級特技。 – vinhboy
@vinhboy這可能是因爲supertest只是帶有expect()函數的'superagent'。如果您查看superagent的文檔https://visionmedia.github.io/superagent/,您可以看到使用示例描述的查詢功能。 –