Skip to content

Instantly share code, notes, and snippets.

@noamt
Created February 18, 2020 15:58
Show Gist options
  • Save noamt/eda05bc82f726d1918804b55b39944eb to your computer and use it in GitHub Desktop.
Save noamt/eda05bc82f726d1918804b55b39944eb to your computer and use it in GitHub Desktop.
For blog post "Simulating SSL outages with Go"
package reachout_test
import (
"net/http"
"net/http/httptest"
"os"
"testing"
)
func Test_ReachOut(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// handle test request
}))
defer server.Close()
os.Setenv("API_HOST", server.URL)
response := reachout.ReachOut()
// assert response
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment