Feat: add query params

This commit is contained in:
2025-11-10 11:07:36 +08:00
parent 9a39bcda40
commit dbd2ed6469
16 changed files with 293 additions and 37 deletions

View File

@@ -12,17 +12,17 @@ func ping() {
for _, msg := range msgs {
fmt.Printf("client sending: '%s'\n", msg)
b, err := tcp.Post(":8080", "/", []byte(msg))
resp, err := tcp.Get(":8080", "/test", map[string]string{"msg": msg})
if err != nil {
panic(err)
}
fmt.Printf("server reply: '%s'\n", string(b))
fmt.Printf("server reply: '%s'\n", string(resp.Body))
}
}
func pull() {
socket, err := tcp.Dial(":8080", "/")
socket, err := tcp.Dial(":8080", "/test")
if err != nil {
panic(err)
}
@@ -40,6 +40,6 @@ func pull() {
var clientCmd = &cobra.Command{
Use: "client",
Run: func(cmd *cobra.Command, args []string) {
pull()
ping()
},
}