Skip to content

Commit f5026d7

Browse files
committed
docs: update the main page go code to look less 2015
1 parent e263160 commit f5026d7

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

pages/index.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,20 @@ const go = `package main
6363
import (
6464
"fmt"
6565
"net/http"
66-
"io/ioutil"
6766
)
6867
6968
func main() {
70-
url := "https://upload.estuary.tech/content/add"
71-
method := "POST"
69+
const url = "https://upload.estuary.tech/content/add"
7270
73-
client := &http.Client {
74-
}
75-
req, err := http.NewRequest(method, url, nil)
71+
req, err := http.NewRequest(http.MethodPost, url, nil)
72+
if err != nil { panic(err) }
7673
req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
7774
req.Header.Add("Accept", "application/json")
78-
res, err := client.Do(req)
75+
res, err := http.DefaultClient.Do(req)
76+
if err != nil { panic(err) }
7977
defer res.Body.Close()
80-
body, err := ioutil.ReadAll(res.Body)
81-
fmt.Println(string(body))
78+
_, err = io.Copy(os.Stdout, res.Body)
79+
if err != nil { panic(err) }
8280
}`;
8381

8482
const python = `import requests

0 commit comments

Comments
 (0)