diff --git a/isp/convenience.go b/isp/convenience.go index f326e87..4f08f45 100644 --- a/isp/convenience.go +++ b/isp/convenience.go @@ -9,6 +9,7 @@ import ( "net/http/httputil" "net/url" "reflect" + "time" link "github.com/tent/http-link-go" "golang.org/x/oauth2/clientcredentials" @@ -245,6 +246,17 @@ func NewWithAuthHeader(header string) *HighLevelClient { // TODO: remove this... for some reason it is missing in the generated output. // At some point we need to switch to a less wonky code generator. -func parameterToString(v interface{}, s string) string { - return fmt.Sprintf("%v", v) +func parameterToString(v interface{}, _ string) string { + // Special-case time.Time and *time.Time to ensure RFC3339Nano formatting. + switch val := v.(type) { + case time.Time: + return val.UTC().Format(time.RFC3339Nano) + case *time.Time: + if val == nil { + return "" + } + return val.UTC().Format(time.RFC3339Nano) + default: + return fmt.Sprintf("%v", v) + } }