Introduction
This challenge aims to test your ability to use the net/http
package in Golang to issue HTTP requests.
This tutorial is from open-source community. Access the source code
This challenge aims to test your ability to use the net/http
package in Golang to issue HTTP requests.
You are required to write a program that sends an HTTP GET request to a server and prints the HTTP response status and the first 5 lines of the response body.
net/http
package to issue an HTTP GET request.$ go run http-clients.go
Response status: 200 OK
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Go by Example</title>
In this challenge, you have learned how to use the net/http
package in Golang to issue HTTP requests and handle errors.