1、响应报文测试方法

示例:

package main

import (
	"fmt"
	"net/http"
)

//服务端编写的业务逻辑处理程序
func myHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "hello world")
}

func main() {
	http.HandleFunc("/go", myHandler)

	//在指定的地址进行监听,开启一个HTTP
	http.ListenAndServe("127.0.0.1:8000", nil)
}

执行结果:

Go语言之进阶篇响应报文测试方法

 

相关文章:

  • 2022-01-11
  • 2021-12-17
  • 2022-01-30
  • 2021-11-13
  • 2022-02-18
  • 2021-06-22
  • 2021-12-05
  • 2022-02-04
猜你喜欢
  • 2021-11-14
  • 2021-09-05
  • 2021-10-22
  • 2021-11-22
  • 2021-07-23
  • 2022-01-04
  • 2021-06-26
相关资源
相似解决方案