Commit c66ef25b authored by ibuler's avatar ibuler

[Update] Merge master to local master (conflict: pkg/sdk/client.go)

parents 834a0e68 22805668
......@@ -14,6 +14,7 @@ type ClientAuth interface {
type WrapperClient struct {
Http *common.Client
AuthClient *common.Client
Auth ClientAuth
BaseHost string
}
......@@ -42,16 +43,24 @@ func (c *WrapperClient) CheckAuth() error {
}
func (c *WrapperClient) Get(url string, res interface{}, needAuth bool) error {
<<<<<<< HEAD
//if needAuth {
// c.Http.SetAuth(c.Auth.Sign())
//} else {
// c.Http.SetAuth("")
//}
=======
if needAuth {
return c.AuthClient.Get(c.BaseHost+url, res)
} else {
return c.Http.Get(c.BaseHost+url, res)
}
>>>>>>> 228056688660034ec5b8061e99c187aa0b1c85e7
}
func (c *WrapperClient) Post(url string, data interface{}, res interface{}, needAuth bool) error {
<<<<<<< HEAD
//if needAuth {
// c.Http.SetAuth(c.Auth.Sign())
//} else {
......@@ -85,4 +94,35 @@ func (c *WrapperClient) Patch(url string, data interface{}, res interface{}, nee
// c.Http.SetAuth("")
//}
return c.Http.Patch(url, data, res)
=======
if needAuth {
return c.AuthClient.Post(url, data, res)
} else {
return c.Http.Post(url, data, res)
}
}
func (c *WrapperClient) Delete(url string, res interface{}, needAuth bool) error {
if needAuth {
return c.AuthClient.Delete(url, res)
} else {
return c.Http.Delete(url, res)
}
}
func (c *WrapperClient) Put(url string, data interface{}, res interface{}, needAuth bool) error {
if needAuth {
return c.AuthClient.Put(url, data, res)
} else {
return c.Http.Put(url, data, res)
}
}
func (c *WrapperClient) Patch(url string, data interface{}, res interface{}, needAuth bool) error {
if needAuth {
return c.AuthClient.Patch(url, data, res)
} else {
return c.Http.Patch(url, data, res)
}
>>>>>>> 228056688660034ec5b8061e99c187aa0b1c85e7
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment