package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
jsonStr := []byte(`{ "username": "auto", "password": "auto123123" }`)
url := "https://www.denlery.top/api/v1/login"
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
// handle error
}
defer resp.Body.Close()
statuscode := resp.StatusCode
hea := resp.Header
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
fmt.Println(statuscode)
fmt.Println(hea)
}
func httpGet() {
url := "https://pro-backend.99tv.ai/v1/overseas/admin/template/getTemplateInfoById?link_id="
resp, err := http.Get(url)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
_, err = io.ReadAll(resp.Body)
if resp.StatusCode == 200 {
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。