We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e16b71 commit 8242955Copy full SHA for 8242955
internal/client/client.go
@@ -25,19 +25,21 @@ func init() {
25
}
26
27
func Get(url string) []byte {
28
- resp, err := http.Get(url)
29
- base.CheckErr(err)
30
- defer resp.Body.Close()
31
- body, err := ioutil.ReadAll(resp.Body)
32
33
- return body
+ if resp, err := http.Get(url); err == nil {
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ base.CheckErr(err)
+ return body
+ }
34
+ return nil
35
36
37
func PostJson(url, jsonStr string) []byte {
- resp, err := http.Post(url, "application/json", strings.NewReader(jsonStr))
38
39
40
41
42
+ if resp, err := http.Post(url, "application/json", strings.NewReader(jsonStr)); err == nil {
43
44
45
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments