10764: Test v0 session.
[arvados.git] / sdk / go / arvados / client.go
index fc937494e5a679728aea021dbe80a95231582d72..9691e7a07e475668cc73a80dffba466addb3b4ef 100644 (file)
@@ -10,6 +10,7 @@ import (
        "net/http"
        "net/url"
        "os"
+       "regexp"
        "strings"
        "time"
 )
@@ -180,6 +181,7 @@ func (c *Client) RequestAndDecode(dst interface{}, method, path string, body io.
        if err != nil {
                return err
        }
+       req.Header.Set("Content-type", "application/x-www-form-urlencoded")
        return c.DoAndDecode(dst, req)
 }
 
@@ -241,7 +243,12 @@ func (c *Client) DiscoveryDocument() (*DiscoveryDocument, error) {
        return c.dd, nil
 }
 
+var pdhRegexp = regexp.MustCompile(`^[0-9a-f]{32}\+\d+$`)
+
 func (c *Client) modelForUUID(dd *DiscoveryDocument, uuid string) (string, error) {
+       if pdhRegexp.MatchString(uuid) {
+               return "Collection", nil
+       }
        if len(uuid) != 27 {
                return "", fmt.Errorf("invalid UUID: %q", uuid)
        }