-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
AuthAPI中的login接口存在二次编码问题
例如密码为aaa@111,最终拼接的请求url为baseUrl/account/aaa%2540111
其中,%25对应%,而%40对应@
尝试修改具体登录函数实现
suspend fun login(callback: (WebsiteUser)->Unit){
progressDialog.value = true
"eamil: ${email.value}".toast()
password.value.toast()
// chaneg: 尝试不进行编码直接传递
// val passStr = URLEncoder.encode(password.value, "utf-8")
val passStr = password.value
val res = Net.auth.login(email.value, passStr) .awaitResponseOK()
res.onSuccessful {
it?.let { data ->
progressDialog.value = false
callback(data)
}
}.onFailed { _, msg ->
showError(msg)
}
}发现最终请求直接不对特殊字符进行编码
而修改login接口
@GET("Auth/{email}/{password}")
fun login(@Path("email", encoded = false) email: String,
// change: 将encoded设置为true
@Path("password", encoded = true) password: String
): Call<Response<WebsiteUser>>可以达到预期并正常登录
Metadata
Metadata
Assignees
Labels
No labels