Browse Source

Remove redunant w.WriteHeader lines after http.Error

pull/1/head
Tovi Jaeschke-Rogers 2 years ago
parent
commit
ecac186187
5 changed files with 0 additions and 16 deletions
  1. +0
    -1
      Backend/Api/Auth/Login.go
  2. +0
    -1
      Backend/Api/Auth/Signup.go
  3. +0
    -5
      Backend/Api/Friends/AcceptFriendRequest.go
  4. +0
    -7
      Backend/Api/Friends/Friends.go
  5. +0
    -2
      Backend/Api/Friends/RejectFriendRequest.go

+ 0
- 1
Backend/Api/Auth/Login.go View File

@ -43,7 +43,6 @@ func makeLoginResponse(w http.ResponseWriter, code int, message, pubKey, privKey
}, "", " ") }, "", " ")
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }


+ 0
- 1
Backend/Api/Auth/Signup.go View File

@ -32,7 +32,6 @@ func makeSignupResponse(w http.ResponseWriter, code int, message string) {
}, "", " ") }, "", " ")
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }


+ 0
- 5
Backend/Api/Friends/AcceptFriendRequest.go View File

@ -33,7 +33,6 @@ func AcceptFriendRequest(w http.ResponseWriter, r *http.Request) {
oldFriendRequest, err = Database.GetFriendRequestByID(friendRequestID) oldFriendRequest, err = Database.GetFriendRequestByID(friendRequestID)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
@ -43,21 +42,18 @@ func AcceptFriendRequest(w http.ResponseWriter, r *http.Request) {
requestBody, err = ioutil.ReadAll(r.Body) requestBody, err = ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
err = json.Unmarshal(requestBody, &newFriendRequest) err = json.Unmarshal(requestBody, &newFriendRequest)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
err = Database.UpdateFriendRequest(&oldFriendRequest) err = Database.UpdateFriendRequest(&oldFriendRequest)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
@ -67,7 +63,6 @@ func AcceptFriendRequest(w http.ResponseWriter, r *http.Request) {
err = Database.CreateFriendRequest(&newFriendRequest) err = Database.CreateFriendRequest(&newFriendRequest)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }


+ 0
- 7
Backend/Api/Friends/Friends.go View File

@ -22,14 +22,12 @@ func CreateFriendRequest(w http.ResponseWriter, r *http.Request) {
requestBody, err = ioutil.ReadAll(r.Body) requestBody, err = ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
err = json.Unmarshal(requestBody, &friendRequest) err = json.Unmarshal(requestBody, &friendRequest)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
@ -38,14 +36,12 @@ func CreateFriendRequest(w http.ResponseWriter, r *http.Request) {
err = Database.CreateFriendRequest(&friendRequest) err = Database.CreateFriendRequest(&friendRequest)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
returnJSON, err = json.MarshalIndent(friendRequest, "", " ") returnJSON, err = json.MarshalIndent(friendRequest, "", " ")
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
@ -66,14 +62,12 @@ func CreateFriendRequestQrCode(w http.ResponseWriter, r *http.Request) {
requestBody, err = ioutil.ReadAll(r.Body) requestBody, err = ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
err = json.Unmarshal(requestBody, &friendRequests) err = json.Unmarshal(requestBody, &friendRequests)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
@ -85,7 +79,6 @@ func CreateFriendRequestQrCode(w http.ResponseWriter, r *http.Request) {
err = Database.CreateFriendRequests(&friendRequests) err = Database.CreateFriendRequests(&friendRequests)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }


+ 0
- 2
Backend/Api/Friends/RejectFriendRequest.go View File

@ -29,14 +29,12 @@ func RejectFriendRequest(w http.ResponseWriter, r *http.Request) {
friendRequest, err = Database.GetFriendRequestByID(friendRequestID) friendRequest, err = Database.GetFriendRequestByID(friendRequestID)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }
err = Database.DeleteFriendRequest(&friendRequest) err = Database.DeleteFriendRequest(&friendRequest)
if err != nil { if err != nil {
http.Error(w, "Error", http.StatusInternalServerError) http.Error(w, "Error", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return return
} }


Loading…
Cancel
Save