Last active
January 20, 2016 16:20
-
-
Save hackintoshrao/f5196a023776ae50d098 to your computer and use it in GitHub Desktop.
starting caddy server from within the code as an external application with specified configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestBrowseMiddlewareForHtmlResponse(t *testing.T) { | |
//formulating configuration for starting Caddy. | |
//The configuration below is used defualt host <localhost> and default port <2015> for running the server | |
//browse middleware is activated | |
input := caddy.CaddyfileInput{ | |
Contents: []byte(fmt.Sprintf("%s:%s\nbasicauth /protected my-username my-passworde ", caddy.DefaultHost, "2015")), | |
} | |
//starting caddy server | |
err := caddy.Start(input) | |
if err != nil { | |
t.Fatalf("Error starting caddy: %v", err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment