Missing Location
header field on resource creation with a POST
#593
Labels
bug
Something isn't working
Location
header field on resource creation with a POST
#593
Describe the bug
It is common in RESTful CRUD services to return the resource URI of a newly created resource with a
POST
HTTP operation via theLocation
header field. Many operations (e.g. creation of a DID) return information on the new resource name in the response body as a string (even though the request has specified an accepted typeapplication/json
). However, when importing a JWK key, only an empty response body is returned, and the resource orkeyId
of the new key is completely unknown (unless akid
element was part of the JWK imported already).It is customary to use the HTTP protocol on RESTful CRUD operations by specifying the
Location
header field with the full URI to the created resource. That also eliminates the need of a HTTP body in the response. (If I'm picky, we'd expect a201 Create
response here instead of a200 OK
, but that's tolerable if the information is available).To Reproduce
Steps to reproduce the behaviour:
POST /wallet-api/wallet/{wallet}/keys/import
200 OK
responseExpected behaviour
Preferably the new resource URI in the
Location
header field of the response. Alternatively (or both) the resource URI or minimally the new key ID in the response body.Actual behaviour
Unidentifiable key ID or new key's resource URI.
Environment
curl
command line, scripted (e.g. Python) or via the Swagger UI.The text was updated successfully, but these errors were encountered: