kopflos icon indicating copy to clipboard operation
kopflos copied to clipboard

Implicitly fail requests with missing body when operation expects a payload

Open tpluscode opened this issue 5 years ago • 0 comments

It seems repetitive and unnecessary to check the request object every time for the body like

function (req, res) {
  if (!req.dataset) {
    res.send(400)
  }

  // happy path
}

For RDF requests I expect that the operation would be defined as hydra:expects api:SomeClass. I propose to add an implicit check and send a 400 response if the request has no body.

Gotta think how this would affect non-RDF requests. Clearly an application/pdf or a multi-part body would not attach dataset/quadStream so as long as a body exists the request should continue.

tpluscode avatar May 13 '20 08:05 tpluscode