srijeet0406 commented on a change in pull request #4942:
URL: https://github.com/apache/trafficcontrol/pull/4942#discussion_r505763336
##########
File path: traffic_ops/traffic_ops_golang/api/api.go
##########
@@ -999,11 +999,28 @@ func CreateDeprecationAlerts(alternative *string)
tc.Alerts {
}
}
+// CheckIfUnModified checks to see if the resource was modified since the
"If-Unmodified-Since" header value in the request.
+// In case it was, the 412 error code is returned. If some other error was
encountered while checking, the appropriate error code along with
+// error details is returned. If the resource was not modified since the
specified time, the UPDATE proceeds in the normal fashion.
+func CheckIfUnModified(h http.Header, tx *sqlx.Tx, ID int, tableName string)
(error, error, int) {
+ existingLastUpdated, found, err := GetLastUpdated(tx, ID, tableName)
+ if err == nil && found == false {
+ return errors.New("no delivery service request found with this
id"), nil, http.StatusNotFound
Review comment:
yeah sorry was a copy paste error, will fix it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]