package
0.0.0-20241113072534-4ea02956913a
Repository: https://github.com/forestyc/playground.git
Documentation: pkg.go.dev
# README
http
http server and client
1. Client
import (
"fmt"
"github.com/Baal19905/playground/pkg/http"
)
func main() {
client := http.NewClient(false)
defer client.Close()
resp, err := client.Do(
"get",
"http://localhost:8080",
nil,
nil,
)
if err != nil {
panic(err)
}
fmt.Println(string(resp))
}
2. Server
import (
"github.com/forestyc/playground/pkg/http"
"github.com/gin-gonic/gin"
netHttp "net/http"
)
func main() {
// ...
server := http.NewServer(":8080")
server.Serve()
server.Router.GET("/", func(c *gin.Context) {
c.String(netHttp.StatusOK, "Hello World")
})
// ...
}
# Functions
NewClient create http client When keepAlive is true, the connection can be reused, vice versa.
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author