fix password resty api
This commit is contained in:
父節點
f161616eae
當前提交
79355bab7c
@ -2,6 +2,7 @@ package httpclient
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
"integrity-checkin/data/dto"
|
"integrity-checkin/data/dto"
|
||||||
"regexp"
|
"regexp"
|
||||||
@ -14,10 +15,8 @@ func Setup() {
|
|||||||
Client = resty.New().SetTimeout(10 * time.Second)
|
Client = resty.New().SetTimeout(10 * time.Second)
|
||||||
}
|
}
|
||||||
func SDULogin(username string, password string) (*dto.SDULoginData, error) {
|
func SDULogin(username string, password string) (*dto.SDULoginData, error) {
|
||||||
resp, err := Client.R().SetFormData(map[string]string{
|
resp, err := Client.R().SetBody(fmt.Sprintf("username=%v&password=%v", username, password)).
|
||||||
"username": username,
|
Post("https://pass.sdu.edu.cn/cas/restlet/tickets")
|
||||||
"password": password,
|
|
||||||
}).Post("https://pass.sdu.edu.cn/cas/restlet/tickets")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
載入中…
x
新增問題並參考
Block a user