braid-org / braid-spec

Working area for Braid extensions to HTTP
https://braid.org
236 stars 16 forks source link

Patch types via `Patch-Type` instead of `Content-Type` #126

Open toomim opened 1 year ago

toomim commented 1 year ago

The spec currently specifies custom patch types in the same way that the HTTP PATCH method does: using the Content-Type header.

But this sucks, because it clobbers other uses of Content-Type that we care about.

This rules out these use-cases:

So I propose that we ignore how PATCH does things, and introduce an actual Patch-Type header for patch types. This PR makes the change. We only need to change 6 lines.

(More context in https://braid.org/meeting-69/http-patch-design)

toomim commented 1 year ago

Note: this is a counter-proposal to https://github.com/braid-org/braid-spec/pull/120

toomim commented 1 year ago

Rahul (@cxres) pointed out a problem with my thinking here: Content-Type describes the content of the HTTP message, not the resource. Specifically:

HTTP/1.1 200 OK
Header1: value1
Header2: value2

this is content         <--- "content" is the stuff after the newline

That means that if we put a patch in the content section, we need the Content-Type: header to describe that patch.

But we still need a way to communicate the mime-type that the patch is applying to. So perhaps we just need two headers, like:

Content-Type: application/range-patch
Representation-Type: application/json

Or a hybrid parameterized patch type, like:

Content-Type: application/range-patch(on: application/json)
toomim commented 1 year ago

(Chair:) Since this has gotten more complicated, I don't think we can resolve it in time for draft 03, and I'm removing it from that milestone.