Closed liuxia19872003 closed 1 year ago
You pass the Formdata instance and set the content-type to undefined
I read the mande's code and think that coding like this will be more elegant:
export async function mandeLoginGetToken(username: string, password: string) {
console.log("mandeLoginGetToken-1");
const params = new URLSearchParams();
params.append("username", username);
params.append("password", password);
const tokenapi = mande(`${mandeBaseUrl}/login/access-token`);
const res = await tokenapi.post<IToken>(null, {
body: params.toString(),
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
return res;
}
i want to request a token from a fastapi backend,and the code below is ok.
how can i do it with mande? the code below cann't work.