Skip to content

Commit

Permalink
fix querystring
Browse files Browse the repository at this point in the history
  • Loading branch information
ianrose14 committed Nov 25, 2023
1 parent 900a032 commit 9cf2f48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions cmd/webapp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func main() {
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
sig := <-c
log.Printf("received %s signal", sig)
log.Printf("received %q signal", sig)
cancel()
}()

Expand Down Expand Up @@ -126,12 +126,10 @@ func main() {

stravaDb := strava.NewSqliteDb(db)
mux.HandleFunc("/strava/exchange_token/", func(w http.ResponseWriter, r *http.Request) {
log.Printf("token exchange strava request to %v", r.URL)
strava.TokenHandler(w, r, stravaDb, stravaAccount)
})
{
h := func(w http.ResponseWriter, r *http.Request) {
log.Printf("basic strava request to %v", r.URL)
strava.Handler(w, r, stravaTemplate, stravaDb, stravaAccount)
}
mux.HandleFunc("/running/", h)
Expand Down
2 changes: 1 addition & 1 deletion internal/strava/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func TokenHandler(w http.ResponseWriter, r *http.Request, db KVDB, account *ApiP
qs := make(url.Values)
qs.Set("username", profile.Username)
qs.Set("year", strconv.Itoa(time.Now().Year()))
urlStr := "/running/?username=" + qs.Encode()
urlStr := "/running/?" + qs.Encode()
log.Printf("successful token exchange, redirecting to %s", urlStr)
http.Redirect(w, r, urlStr, http.StatusTemporaryRedirect)
}

0 comments on commit 9cf2f48

Please sign in to comment.