Skip to content

Commit

Permalink
chages requested on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Angelo committed Aug 27, 2021
1 parent 6975999 commit e799b54
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions rest/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ func (s *ApplicationsService) List() ([]*pulsar.Application, *http.Response, err
return nil, nil, err
}

al := []*pulsar.Application{}
var resp *http.Response
resp, err = s.client.Do(req, &al)
var al []*pulsar.Application
resp, err := s.client.Do(req, &al)
if err != nil {
return nil, resp, err
}
Expand All @@ -43,11 +42,10 @@ func (s *ApplicationsService) Get(id string) (*pulsar.Application, *http.Respons

var a pulsar.Application
resp, err := s.client.Do(req, &a)

if err != nil {
switch err.(type) {
case *Error:
if err.(*Error).Message == "pulsar app not found" {
if err.(*Error).Resp.StatusCode == 404 {
return nil, resp, ErrApplicationMissing
}
}
Expand All @@ -62,11 +60,11 @@ func (s *ApplicationsService) Get(id string) (*pulsar.Application, *http.Respons
// The given application must have at least the name
// NS1 API docs: https://ns1.com/api#put-create-a-pulsar-application
func (s *ApplicationsService) Create(a *pulsar.Application) (*http.Response, error) {
req, err := s.client.NewRequest("PUT", "pulsar/apps", &a)
req, err := s.client.NewRequest("PUT", "pulsar/apps", a)
if err != nil {
return nil, err
}
resp, err := s.client.Do(req, &a)
resp, err := s.client.Do(req, a)
return resp, err
}

Expand All @@ -82,7 +80,6 @@ func (s *ApplicationsService) Update(a *pulsar.Application) (*http.Response, err
}

resp, err := s.client.Do(req, &a)

if err != nil {
switch err.(type) {
case *Error:
Expand Down

0 comments on commit e799b54

Please sign in to comment.