我正在关注有关 aqueduct 文档的教程,我正在尝试发送一个 post 请求来测试 auth 端点,但我没有成功地正确设置它,因为我刚刚开始在教程中使用它...< /p>
教程代码
Future<void> main() async {
const clientID = "org.hasenbalg.zeiterfassung";
const body = "username=bob&password=password&grant_type=password";
final String clientCredentials =
const Base64Encoder().convert("$clientID:".codeUnits);
final http.Response response =
await http.post("http://localhost:8888/auth/token",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Basic $clientCredentials"
},
body: body);
print(response.body);
}
如何设置邮递员发出这个请求? 如果我设置授权类型 OAuth2.0 它需要访问令牌,这是应该从请求返回的内容。 如果我按照此处的建议选择基本身份验证 Postman: Sending Request with headers 而不是没有客户端 ID 放置..
另外..如何使用application/json
来设置它(我对它有点熟悉..)?
非常感谢