diff options
| author | Adnan Maolood <[email protected]> | 2021-02-20 16:15:26 -0500 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2021-02-20 16:16:32 -0500 |
| commit | 893803879742057befabc4f6b5d4d412ac6612b6 (patch) | |
| tree | 6d873d5645af6cbc4332f618e5950568bc1df486 /examples | |
| parent | TimeoutHandler: Use provided context (diff) | |
| download | go-gemini-893803879742057befabc4f6b5d4d412ac6612b6.tar.xz go-gemini-893803879742057befabc4f6b5d4d412ac6612b6.zip | |
Make Status a type
Using a type is better than using an integer.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/client.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/client.go b/examples/client.go index 21f09c5..c806a8f 100644 --- a/examples/client.go +++ b/examples/client.go @@ -102,7 +102,7 @@ func do(req *gemini.Request, via []*gemini.Request) (*gemini.Response, error) { return resp, err } - switch gemini.StatusClass(resp.Status) { + switch resp.Status.Class() { case gemini.StatusInput: input, ok := getInput(resp.Meta, resp.Status == gemini.StatusSensitiveInput) if !ok { @@ -155,7 +155,7 @@ func main() { defer resp.Body.Close() // Handle response - if gemini.StatusClass(resp.Status) == gemini.StatusSuccess { + if resp.Status.Class() == gemini.StatusSuccess { body, err := io.ReadAll(resp.Body) if err != nil { log.Fatal(err) |