Don't guarantee that (*Response).Body is always non-nil

This commit is contained in:
Adnan Maolood
2020-11-08 18:38:08 -05:00
parent 6b3cf1314b
commit 5332dc6280
3 changed files with 5 additions and 7 deletions

5
doc.go
View File

@@ -7,7 +7,10 @@ Get makes a Gemini request:
if err != nil {
// handle error
}
defer resp.Body.Close()
if resp.Status.Class() == gemini.StatusClassSucess {
defer resp.Body.Close()
// ...
}
// ...
For control over client behavior, create a Client: