Browse Source

Rearrange status checks in CreatePost

pull/9/head
Matt Baer 5 years ago
parent
commit
5d3a329a7a
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      post.go

+ 5
- 5
post.go View File

@@ -124,13 +124,13 @@ func (c *Client) CreatePost(sp *PostParams) (*Post, error) {
}

status := env.Code
if status == http.StatusCreated {
return p, nil
} else if status == http.StatusBadRequest {
return nil, fmt.Errorf("Bad request: %s", env.ErrorMessage)
} else {
if status != http.StatusCreated {
if status == http.StatusBadRequest {
return nil, fmt.Errorf("Bad request: %s", env.ErrorMessage)
}
return nil, fmt.Errorf("Problem creating post: %d. %v\n", status, err)
}
return p, nil
}

// UpdatePost updates a published post with the given PostParams. See


Loading…
Cancel
Save