vendor: update all dependencies

This commit is contained in:
Nick Craig-Wood 2018-06-17 17:59:12 +01:00
parent 3f0789e2db
commit 08021c4636
2474 changed files with 435818 additions and 282709 deletions

View file

@ -270,11 +270,20 @@ func ProcessMediaOptions(opts []MediaOption) *MediaOptions {
func ResolveRelative(basestr, relstr string) string {
u, _ := url.Parse(basestr)
afterColonPath := ""
if i := strings.IndexRune(relstr, ':'); i > 0 {
afterColonPath = relstr[i+1:]
relstr = relstr[:i]
}
rel, _ := url.Parse(relstr)
u = u.ResolveReference(rel)
us := u.String()
if afterColonPath != "" {
us = fmt.Sprintf("%s:%s", us, afterColonPath)
}
us = strings.Replace(us, "%7B", "{", -1)
us = strings.Replace(us, "%7D", "}", -1)
us = strings.Replace(us, "%2A", "*", -1)
return us
}

View file

@ -118,6 +118,50 @@ func TestExpand(t *testing.T) {
}
}
func TestResolveRelative(t *testing.T) {
resolveRelativeTests := []struct {
basestr string
relstr string
want string
}{
{
"http://www.golang.org/", "topics/myproject/mytopic",
"http://www.golang.org/topics/myproject/mytopic",
},
{
"http://www.golang.org/", "topics/{+myproject}/{release}:build:test:deploy",
"http://www.golang.org/topics/{+myproject}/{release}:build:test:deploy",
},
{
"https://www.googleapis.com/admin/reports/v1/", "/admin/reports_v1/channels/stop",
"https://www.googleapis.com/admin/reports_v1/channels/stop",
},
{
"https://www.googleapis.com/admin/directory/v1/", "customer/{customerId}/orgunits{/orgUnitPath*}",
"https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/orgUnitPath*}",
},
{
"https://www.googleapis.com/tagmanager/v2/", "accounts",
"https://www.googleapis.com/tagmanager/v2/accounts",
},
{
"https://www.googleapis.com/tagmanager/v2/", "{+parent}/workspaces",
"https://www.googleapis.com/tagmanager/v2/{+parent}/workspaces",
},
{
"https://www.googleapis.com/tagmanager/v2/", "{+path}:create_version",
"https://www.googleapis.com/tagmanager/v2/{+path}:create_version",
},
}
for i, test := range resolveRelativeTests {
got := ResolveRelative(test.basestr, test.relstr)
if got != test.want {
t.Errorf("got %q expected %q in test %d", got, test.want, i+1)
}
}
}
type CheckResponseTest struct {
in *http.Response
bodyText string