Set Location header after creating an election

This commit is contained in:
2024-12-31 15:30:45 +01:00
parent 40f11c75af
commit ee21f00d3f

View File

@ -4,6 +4,7 @@ import (
api "code.dlmw.ch/dlmw/qv/internal"
"code.dlmw.ch/dlmw/qv/internal/validator"
"encoding/json"
"fmt"
"math/rand"
"net/http"
"time"
@ -59,6 +60,7 @@ func (app *application) createElection(w http.ResponseWriter, r *http.Request) {
}
}
w.Header().Set("Location", fmt.Sprintf("/elections/%v", electionId))
w.Write(res)
}