×

restful

golang的net/http包Client的使用

Athey Athey 发表于2024-05-24 浏览5015 评论0
1. Client结构体 1.1 从一个极简示例开始 先写一个Get的极简示例,访问gitlab的所有项目(因为极简示例没有加token,因此只能获取到gitlab中开放的项目) func HiHttp(){ resp, err := http.Get("http://gitlabcto.xxx.com.cn/api/v4/projects") if err != nil { // handle error } defer resp.Body.Close(