日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

Golang 發送http請求工具

作者:魯尼的小寶貝 更新時間: 2022-03-15 編程語言

代碼地址

????????https://github.com/poemp/ghttp/tree/main

使用方式

go get -u github.com/poemp/ghttp

Get請求

????????

import (
	"fmt"
	"ghttp/ghttp"
)

func goGet()  {
	http := ghttp.NewHttp()
	s := http.Headers(map[string]string{
		"auth": "1234",
	}).Get().Req("https://wwww.baidu.com", map[string]string{
		"keyword":"golang",
	})
	fmt.Println(s)
}

Post請求

import (
	"fmt"
	"ghttp/ghttp"
)



func doPost(){
	http := ghttp.NewHttp()
	s :=http.Headers(map[string]string{
		"auth":"ssss",
	}).Post().Json().Req("https://127.0.0.1:8080", map[string]string{
		"keyword":"golang",
	})
	fmt.Println(s)
}

原文鏈接:https://blog.csdn.net/poem_2010/article/details/120804643

欄目分類
最近更新