Set Location header after creating an election
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
|||||||
api "code.dlmw.ch/dlmw/qv/internal"
|
api "code.dlmw.ch/dlmw/qv/internal"
|
||||||
"code.dlmw.ch/dlmw/qv/internal/validator"
|
"code.dlmw.ch/dlmw/qv/internal/validator"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"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)
|
w.Write(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user