Corrected urlFormat() from peer_cache which constructed url with API's name at the end
This commit is contained in:
		@@ -48,7 +48,7 @@ func (p *PeerCache) urlFormat(url string, dt tools.DataType) string {
 | 
				
			|||||||
			url = strings.ReplaceAll(url, localhost, dt.API()+":8080/oc")
 | 
								url = strings.ReplaceAll(url, localhost, dt.API()+":8080/oc")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		url = url + "/" + dt.API()
 | 
							url = dt.API() + "/" + url
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return url
 | 
						return url
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -61,11 +61,13 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string) (*Peer, bool)
 | 
				
			|||||||
	if code != 200 {                       // no peer no party
 | 
						if code != 200 {                       // no peer no party
 | 
				
			||||||
		return nil, false
 | 
							return nil, false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	url := p.urlFormat(res.(*Peer).Url, tools.PEER) + "/status" // Format the URL
 | 
						url := p.urlFormat(res.(*Peer).Url, tools.PEER) + "/status" // Format the URL
 | 
				
			||||||
	state, services := api.CheckRemotePeer(url)
 | 
						state, services := api.CheckRemotePeer(url)
 | 
				
			||||||
	res.(*Peer).ServicesState = services                              // Update the services states of the peer
 | 
						res.(*Peer).ServicesState = services                              // Update the services states of the peer
 | 
				
			||||||
	access.UpdateOne(res, peerID)                                     // Update the peer in the db
 | 
						access.UpdateOne(res, peerID)                                     // Update the peer in the db
 | 
				
			||||||
 | 
						fmt.Println("URL peer : ", url)
 | 
				
			||||||
 | 
						fmt.Println("State : ", state)
 | 
				
			||||||
 | 
						fmt.Println("Services : ", services)
 | 
				
			||||||
	return res.(*Peer), state != tools.DEAD && services[appName] == 0 // Return the peer and its status
 | 
						return res.(*Peer), state != tools.DEAD && services[appName] == 0 // Return the peer and its status
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user