Skip to content

Commit

Permalink
change to use mix instead of an http handler which cant be unregistered
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Loftus committed Nov 19, 2024
1 parent b33ebff commit 41f2ded
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test_helpers/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,20 @@ import (
log "github.com/sirupsen/logrus"
)

// Spin up a simple file server for serving sitemaps or other static files
func ServeSampleConfigDir() (*http.Server, net.Listener, error) {

dir := filepath.Join(projectpath.Root, "test_helpers", "sample_configs")

http.Handle("/", http.FileServer(http.Dir(dir)))
fileServer := http.FileServer(http.Dir(dir))
mux := http.NewServeMux()
mux.Handle("/", fileServer)

listener, err := net.Listen("tcp", ":0")
if err != nil {
return nil, nil, err
}

// Start the server
server := &http.Server{
Handler: http.DefaultServeMux,
Handler: mux,
}

go func() {
Expand Down

0 comments on commit 41f2ded

Please sign in to comment.