Skip to content

Commit 00b1b32

Browse files
authored
Merge pull request #8 from StandUpCode/develop
feat(error) error handling
2 parents 16549c1 + 11e52cf commit 00b1b32

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

VERSION_HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Version History
22

3+
## `Version 0.3.2`
4+
5+
Released: `2023-01-05`
6+
7+
- Add Error handling
38

49
## `Version 0.2.2`
510
Released: `2022-04-04`

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/StandUpCode/LineLoginAdminSDK
22

3-
go 1.18
3+
go 1.19
44

55
require github.com/valyala/fasthttp v1.34.0
66

lineloginadmin/utils/requests.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,15 @@ func Post(uri string, payload string, content_type string) ([]byte, error) {
4949
fmt.Printf("Client get failed: %s\n", err)
5050
return nil, err
5151
}
52+
53+
if resp.StatusCode() != fasthttp.StatusOK {
54+
fmt.Printf("Expected status code %d but got %d\n", fasthttp.StatusOK, resp.StatusCode())
55+
return nil, err
56+
}
57+
5258
body := resp.Body()
53-
fmt.Printf("Response body is: %s", body)
59+
60+
// fmt.Printf("Response body is: %s", body)
5461

5562
return body, nil
5663

0 commit comments

Comments
 (0)