github.com/alejandroEsc/spdy@v0.0.0-20200317064415-01a02f0eb389/examples/client/client.go (about)

     1  // Copyright 2014 Jamie Hall. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"fmt"
     9  	"io/ioutil"
    10  	"net/http"
    11  
    12  	_ "github.com/SlyMarbo/spdy" // This adds SPDY support to net/http
    13  )
    14  
    15  func main() {
    16  	res, err := http.Get("https://example.com/")
    17  	if err != nil {
    18  		panic(err)
    19  	}
    20  	defer res.Body.Close()
    21  
    22  	bytes, err := ioutil.ReadAll(res.Body)
    23  	if err != nil {
    24  		panic(err)
    25  	}
    26  
    27  	fmt.Printf("Received: %s\n", bytes)
    28  }