Skip to content

Commit

Permalink
Merge pull request danielgtaylor#164 from danielgtaylor/patch-compare
Browse files Browse the repository at this point in the history
fix: better comparison of encoded payloads for patch, fixes danielgtaylor#73
  • Loading branch information
danielgtaylor committed Nov 6, 2023
2 parents 3130224 + ac4573b commit 2c9320f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion autopatch/autopatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func PatchResource(api huma.API, path *huma.PathItem) {
return
}

if bytes.Equal(bytes.TrimSpace(patched), bytes.TrimSpace(origWriter.Body.Bytes())) {
if jsonpatch.Equal(patched, origWriter.Body.Bytes()) {
ctx.SetStatus(http.StatusNotModified)
return
}
Expand Down

0 comments on commit 2c9320f

Please sign in to comment.