Here is one more groundworking PR. With this in, I'm able to implement a
working type TenantGroup with Get, List, Extract, Create, Update and Delete.
Fixed issue with concating urls, removed use of path.Join
The problem here: With path.Join, the trailing slash has been removed on
each call. Even when using NewRequest(..., "/api/XXX/", nil). As a result,
Do always queries http://nebox.example.com/api/XXX, getting back a 301
and retries the new Location. While this works well with GET, it breaks
all the pushing methods. To not override too much, or too less, of
Client.u, I append/prepend/remove slashes if necessary.
Added two new functions to construct requests
c.NewDataRequest to create a request with body
c.NewJSONRequest to make posts more convenient
Changed c.NewRequest to be a wrap for NewJSONRequest
As a result, using NewRequest stays the same, but NewJSONRequest can be
used to create "writing" functions, without the need of repeatedly
checking for errors. e.g. for tenant-groups:
Here is one more groundworking PR. With this in, I'm able to implement a working type TenantGroup with Get, List, Extract, Create, Update and Delete.
The problem here: With path.Join, the trailing slash has been removed on each call. Even when using
NewRequest(..., "/api/XXX/", nil)
. As a result, Do always querieshttp://nebox.example.com/api/XXX
, getting back a 301 and retries the new Location. While this works well with GET, it breaks all the pushing methods. To not override too much, or too less, ofClient.u
, I append/prepend/remove slashes if necessary.As a result, using NewRequest stays the same, but NewJSONRequest can be used to create "writing" functions, without the need of repeatedly checking for errors. e.g. for
tenant-groups
: