Problem
PATCH requests to non-existent resources return 404, but in Solid, PATCH should be able to create resources using N3 Patch with solid:inserts.
Error from PodOS:
Web error: 404 (Not Found) on PATCH of http://localhost:3210/agsdf
Solution
Modify handlePatch to:
- If resource doesn't exist, start with an empty JSON-LD document (
{ "@context": {}, "@graph": [] })
- Apply the patch to create the resource
- Return 201 Created instead of 204 No Content when a new resource is created
This aligns with the Solid protocol where PATCH can be used for resource creation, not just updates.
Changes
handlePatch now creates resources if they don't exist
- Returns 201 for creation, 204 for updates
- If-Match header only checked when resource exists
Problem
PATCH requests to non-existent resources return 404, but in Solid, PATCH should be able to create resources using N3 Patch with
solid:inserts.Error from PodOS:
Solution
Modify
handlePatchto:{ "@context": {}, "@graph": [] })This aligns with the Solid protocol where PATCH can be used for resource creation, not just updates.
Changes
handlePatchnow creates resources if they don't exist