trompamusic/ce-api

allow OPTIONS on json-ld API

Closed this issue · 3 comments

linked data clients use OPTIONS to see what kind of operations that they can do on a server. Because the json-ld export in the CE is read-only, we should implement OPTIONS that returns:

HTTP/1.1 204 No Content
Allow: OPTIONS, GET

so that clients know that they cannot write to the CE.

@alastair @musicog the Allow header should only be set when a wrong request method is being used. We do support POST requests for GraphQL requests. Should this restriction only be made for the /:identifier route?

From what I understand I think that we should do:

OPTIONS /:identifier -> return Allow: OPTIONS, GET
GET /:identifier -> return data (optionally add Allow: OPTIONS, GET)
POST /:identifier -> return method not allowed (optional add Allow: OPTIONS, GET)

I'm not sure if Allow: should also be included in the GET and POST methods, however the header should only appear in the /:identifier route