Skip to content

Commit

Permalink
Merge pull request #420 from danielgtaylor/fix-precond-err-locatoin
Browse files Browse the repository at this point in the history
fix: precondition error location to match other errors
  • Loading branch information
danielgtaylor authored Apr 28, 2024
2 parents bfa7e53 + ac9ece2 commit a93ebe6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions conditional/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (p *Params) PreconditionFailed(etag string, modified time.Time) huma.Status
if p.isWrite {
errors = append(errors, &huma.ErrorDetail{
Message: "If-None-Match: " + match + " precondition failed, " + foundMsg,
Location: "request.headers.If-None-Match",
Location: "headers.If-None-Match",
Value: match,
})
}
Expand All @@ -104,7 +104,7 @@ func (p *Params) PreconditionFailed(etag string, modified time.Time) huma.Status
if p.isWrite {
errors = append(errors, &huma.ErrorDetail{
Message: "If-Match precondition failed, " + foundMsg,
Location: "request.headers.If-Match",
Location: "headers.If-Match",
Value: p.IfMatch,
})
}
Expand All @@ -117,7 +117,7 @@ func (p *Params) PreconditionFailed(etag string, modified time.Time) huma.Status
if p.isWrite {
errors = append(errors, &huma.ErrorDetail{
Message: "If-Modified-Since: " + p.IfModifiedSince.Format(http.TimeFormat) + " precondition failed, resource was modified at " + modified.Format(http.TimeFormat),
Location: "request.headers.If-Modified-Since",
Location: "headers.If-Modified-Since",
Value: p.IfModifiedSince.Format(http.TimeFormat),
})
}
Expand All @@ -129,7 +129,7 @@ func (p *Params) PreconditionFailed(etag string, modified time.Time) huma.Status
if p.isWrite {
errors = append(errors, &huma.ErrorDetail{
Message: "If-Unmodified-Since: " + p.IfUnmodifiedSince.Format(http.TimeFormat) + " precondition failed, resource was modified at " + modified.Format(http.TimeFormat),
Location: "request.headers.If-Unmodified-Since",
Location: "headers.If-Unmodified-Since",
Value: p.IfUnmodifiedSince.Format(http.TimeFormat),
})
}
Expand Down

0 comments on commit a93ebe6

Please sign in to comment.