Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions isp/convenience.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http/httputil"
"net/url"
"reflect"
"time"

link "github.com/tent/http-link-go"
"golang.org/x/oauth2/clientcredentials"
Expand Down Expand Up @@ -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)
}
}