Go Http - Client
Go를 이용한 HTTP Client 샘플코드 1. 심플한 요청 방법 ( Get Method ) package main import ( "fmt" "io/ioutil" "net/http" ) func Request(cgi string){ resp, _:= http.Get(cgi) data, _ := ioutil.ReadAll(resp.Body) resp.Body.Close() fmt.Print(data) } func main(){ Request() } 2. HTTP client를 생성하여 Request 하는 방법. : Client를 생성하면 http에 필요한 여러가지 헤더정보 등을 추가하여 전송이 가능해진다. package main import ( "fmt" "io/ioutil" "net/http" ) f..
Go
2021. 9. 3. 14:40