Skip to content

Commit

Permalink
fixing split tags and fixing nil pointer deference (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
bulju authored Nov 3, 2022
1 parent f4f97c4 commit 0a7885f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func (c *Client) setHeaders() {
}

func (c *Client) checkRateLimit(resp *simpleresty.Response) bool {
if resp.StatusCode == 429 {
remainingOrgSeconds, _ := strconv.Atoi(resp.Resp.Header().Get("X-RateLimit-Reset-Seconds-Org"))
if resp != nil && resp.StatusCode == 429 {
remainingOrgSeconds, _ := strconv.Atoi((resp.Resp.Header().Get("X-RateLimit-Reset-Seconds-Org")))
timeToSleep, _ := strconv.Atoi(resp.Resp.Header().Get("X-RateLimit-Reset-Seconds-IP"))
if remainingOrgSeconds != 0 {
// Got rate-limit by Organization
Expand Down
7 changes: 6 additions & 1 deletion api/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Split struct {
ID *string `json:"id"`
Name *string `json:"name"`
Description *string `json:"description"`
Tags []string `json:"tags,omitempty"`
Tags []SplitTag `json:"tags,omitempty"`
CreationTime *int64 `json:"creationTime"`
RolloutStatusTimestamp *int64 `json:"rolloutStatusTimestamp"`
TrafficType *TrafficType `json:"trafficType"`
Expand Down Expand Up @@ -48,6 +48,11 @@ type SplitUpdateRequest struct {
Description string `json:"description"`
}

// SplitTag represents a tag in the split
type SplitTag struct {
Name string `json:"name"`
}

// List all splits.
//
// Reference: https://docs.split.io/reference/list-splits
Expand Down

0 comments on commit 0a7885f

Please sign in to comment.