1 Star 0 Fork 0

张岳文 / goexample

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 703 Bytes
一键复制 编辑 原始数据 按行查看 历史
张岳文 提交于 2023-10-21 20:39 . add echo-server helm
package main
import (
"fmt"
"net/http"
"net/http/httputil"
)
func main() {
http.HandleFunc("/lifecycle/liveness", func(w http.ResponseWriter, r *http.Request) {})
http.HandleFunc("/lifecycle/readiness", func(w http.ResponseWriter, r *http.Request) {})
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
resp, err := httputil.DumpRequest(r, true)
if err != nil {
fmt.Fprintln(w, "error")
fmt.Fprintln(w, "--------------------------------")
w.Write([]byte(err.Error()))
fmt.Fprintln(w)
} else {
fmt.Fprintln(w, "request")
fmt.Fprintln(w, "--------------------------------")
w.Write(resp)
fmt.Fprintln(w)
}
})
http.ListenAndServe(":80", nil)
}
1
https://gitee.com/zhangyww/goexample.git
git@gitee.com:zhangyww/goexample.git
zhangyww
goexample
goexample
10f26362dfd4

搜索帮助