From 3c14c64f4a127388c5d11444a43c4e18da4abe24 Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 7 Oct 2024 16:01:11 +0200 Subject: [PATCH] url format improved --- models/peer/peer_cache.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/peer/peer_cache.go b/models/peer/peer_cache.go index d7547f4..1eeef2c 100644 --- a/models/peer/peer_cache.go +++ b/models/peer/peer_cache.go @@ -44,6 +44,8 @@ func (p *PeerCache) urlFormat(url string, dt tools.DataType) string { t := r.FindString(url) if t != "" { url = strings.Replace(url, t, dt.API()+":8080", -1) + } else { + strings.ReplaceAll(url, localhost, dt.API()+":8080") } } else { url = url + "/" + dt.API() @@ -86,6 +88,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string, meth := methods[method] // Get the method url to execute meth = strings.ReplaceAll(meth, ":id", dataID) // Replace the id in the url in case of a DELETE / UPDATE method (it's a standard naming in OC) url := "" + // Check the status of the peer if mypeer, ok := p.checkPeerStatus(peerID, dt.API(), caller); !ok { // If the peer is not reachable, add the execution to the failed executions list