Skip to content

Commit 829e766

Browse files
committed
fix: use standardized http status code
Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
1 parent 561f4c1 commit 829e766

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/cloud/packet/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ func (p *Client) EnsureNodeBGPEnabled(ctx context.Context, id string) error {
358358
_, response, err := p.DevicesApi.CreateBgpSession(ctx, id).BGPSessionInput(req).Execute() //nolint:bodyclose // see https://github.com/timakin/bodyclose/issues/42
359359
// if we already had one, then we can ignore the error
360360
// this really should be a 409, but 422 is what is returned
361-
if response != nil && response.StatusCode == 422 && strings.Contains(err.Error(), "already has session") {
361+
if response != nil && response.StatusCode == http.StatusUnprocessableEntity && strings.Contains(err.Error(), "already has session") {
362362
err = nil
363363
}
364364
return err

0 commit comments

Comments
 (0)