chore(tfstated): use a struct{} as context.Context key
This commit is contained in:
parent
3d8812fbd0
commit
478f42f8a9
3 changed files with 5 additions and 2 deletions
|
@ -25,7 +25,7 @@ func handlePost(db *database.DB) http.Handler {
|
|||
_ = errorResponse(w, http.StatusBadRequest, err)
|
||||
return
|
||||
}
|
||||
account := r.Context().Value("account").(*model.Account)
|
||||
account := r.Context().Value(model.AccountContextKey{}).(*model.Account)
|
||||
if idMismatch, err := db.SetState(r.URL.Path, account.Id, data, id); err != nil {
|
||||
if idMismatch {
|
||||
_ = errorResponse(w, http.StatusConflict, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue