Skip to content

Commit

Permalink
Return error if Service Discovery endpoint returns invalid json respo…
Browse files Browse the repository at this point in the history
…nse (TykTechnologies#2451)

If Service Discovery endpoint returns invalid JSON response, gateway panics.
Fixed the issue by returning from the method if an error occurs
  • Loading branch information
komalsukhani authored and buger committed Aug 23, 2019
1 parent b9b98bf commit b818a2b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gateway/service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ func (s *ServiceDiscovery) ParseObject(contents string, jsonParsed *gabs.Contain
jp, err := gabs.ParseJSON([]byte(contents))
if err != nil {
log.Error(err)
return err
}
*jsonParsed = *jp
log.Debug("Got:", jsonParsed)
return err
return nil
}

func (s *ServiceDiscovery) ProcessRawData(rawData string) (*apidef.HostList, error) {
Expand Down

0 comments on commit b818a2b

Please sign in to comment.