Skip to content

Commit

Permalink
add missing /api prefix to rmq url
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Feb 27, 2023
1 parent b3e5c03 commit 2f0d8e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/status/external/rmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ func (h *RMQProvider) Status(req Request) (*Response, error) {
st := time.Now()
client := http.Client{Timeout: h.TimeOut}
u := strings.Replace(req.URL, "rmq://", "https://", 1)
u = strings.Replace(u, "/queues/", "/api/queues/", 1)
resp, err := client.Get(u)
if err != nil {
u = strings.Replace(req.URL, "rmq://", "http://", 1)
u = strings.Replace(u, "/queues/", "/api/queues/", 1)
resp, err = client.Get(u)
if err != nil {
return nil, fmt.Errorf("both https and http failed for %s: %w", req.URL, err)
Expand Down
2 changes: 1 addition & 1 deletion app/status/external/rmq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func TestRMQ_Status(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, "/queues/feeds/notification.queue", r.URL.Path)
require.Equal(t, "/api/queues/feeds/notification.queue", r.URL.Path)
time.Sleep(100 * time.Millisecond)
w.WriteHeader(http.StatusOK)
body, err := os.ReadFile("testdata/rmq.json")
Expand Down

0 comments on commit 2f0d8e8

Please sign in to comment.