Skip to content

Commit

Permalink
Remove wildcards from file names
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano committed Feb 3, 2022
1 parent 35868ba commit efa3531
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/elasticsearch/test/httptest.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ func testElasticsearchServer(t *testing.T, mockServerDir string) *httptest.Serve
}))
}

var pathReplacer = strings.NewReplacer("/", "-", "*", "_")

func pathForURL(url string) string {
clean := strings.Trim(url, "/")
if len(clean) == 0 {
return "root.json"
}
parts := strings.Split(clean, "/")
return strings.Join(parts, "-") + ".json"
return pathReplacer.Replace(clean) + ".json"
}

func recordRequest(t *testing.T, r *http.Request, path string) {
Expand Down

0 comments on commit efa3531

Please # to comment.