By implementing this using the swagger generated client, i stumbled upon 404 Errors against the backend. To debug this I manually crafted a http request
> http --verify=no PATCH https://localhost:8443/v0/items/1/consume Authorization:Bearer=xxx
HTTP/1.1 404 Not Found
404 page not found
Where as PUT works.
> http --verify=no PUT https://localhost:8443/v0/items/1/consume Authorization:Bearer=xxx
I found out that the swagger file defines the API as PATCH whereas the actual backend code implements endpoints with PUT
For reference, see Method definitions here:
maas-server/api/items_api.go
128:func (iah *ItemsApiHandler) ItemsItemidPut(w http.ResponseWriter, r *http.Request) {
245:func (iah *ItemsApiHandler) ItemsItemidConsumePut(w http.ResponseWriter, r *http.Request) {
maas-server/api/users_api.go
183:func (uah *UsersApiHandler) UsersUseridCreditsAddPut(w http.ResponseWriter, r *http.Request) {
211:func (uah *UsersApiHandler) UsersUseridCreditsWithdrawPut(w http.ResponseWriter, r *http.Request) {
275:func (uah *UsersApiHandler) UsersUseridCreditsTransferPut(w http.ResponseWriter, r *http.Request) {
303:func (uah *UsersApiHandler) UsersPasswordPut(w http.ResponseWriter, r *http.Request) {
328:func (uah *UsersApiHandler) UsersUseridPasswordPut(w http.ResponseWriter, r *http.Request) {
In this PR I updated the swagger files to match the backend. (And some whitespace fixes my editor did automatically, which im sorry for messing up this commit a little)
Hi
I wanted to:
By implementing this using the swagger generated client, i stumbled upon 404 Errors against the backend. To debug this I manually crafted a http request
Where as PUT works.
I found out that the swagger file defines the API as
PATCH
whereas the actual backend code implements endpoints withPUT
For reference, see Method definitions here:
In this PR I updated the swagger files to match the backend. (And some whitespace fixes my editor did automatically, which im sorry for messing up this commit a little)