📅  最后修改于: 2022-03-11 14:57:33.755000             🧑  作者: Mango
package mainimport ( "fmt" "log" "net/http" "time")type Payload struct { // ä¼ å¥ä¸éè¦}func (p *Payload) UpdateToS3() error { //åå¨é»è¾,模ææä½èæ¶ time.Sleep(500 * time.Millisecond) fmt.Println("ä¸ä¼ æå") return nil}func payloadHandler(w http.ResponseWriter, r *http.Request) { // ä¸å¡è¿æ»¤ // 请æ±body解æ...... var p Payload go p.UpdateToS3() w.Write([]byte("æä½æå"))}func main() { http.HandleFunc("/payload", payloadHandler) log.Fatal(http.ListenAndServe(":8099", nil))}