Skip to content

Commit

Permalink
Merge pull request #197 from AgenceBio/maud/unmodified_rounding
Browse files Browse the repository at this point in the history
Arrondi à la seconde les dates comparées avec le header unmodified
  • Loading branch information
jillro committed Jun 4, 2024
2 parents 5cf8c19 + 158306e commit b8dfa28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ function enforceRecord ({ queryFn, param }) {
throw new NotFoundApiError('Parcellaire introuvable')
}

if (request.headers['if-unmodified-since'] && new Date(request.headers['if-unmodified-since']).getTime() < record.updated_at) {
console.log(request.headers['if-unmodified-since'], record.updated_at)
if (request.headers['if-unmodified-since'] &&
new Date(request.headers['if-unmodified-since']).getTime() < new Date(record.updated_at.toUTCString()).getTime()) {
throw new PreconditionFailedApiError('Le contenu a été modifié depuis votre dernière requête.')
}

Expand Down

0 comments on commit b8dfa28

Please sign in to comment.