INNER CODE UNIT · Go
m
pace/bricks · tools/testserver/main.go:207
m := oauth2.NewMiddleware(new(OauthBackend)) // nolint: staticcheck
sr := h.PathPrefix("/test").Subrouter()
sr.Use(m.Handler)
// To actually test the Oauth2, one can run the following as an example:
//
// curl -H "Authorization: Bearer 83142f1b767e910e78ba2d554b6708c371f053d13d6075bcc39766853a932253" localhost:3000/test/auth
sr.HandleFunc("/oauth", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Oauth test successful.\n")
})
s := pacehttp.Server(h)
log.Logger().Info().Str("addr", s.Addr).Msg("Starting testserver ...")
// nolint:errcheck
go livetest.Test(context.Background(), []livetest.TestFunc{
func(t *livetest.T) {