@@ -13,7 +13,8 @@ import (
1313)
1414
1515const (
16- shippoAPIBaseURL = "https://api.goshippo.com/v1"
16+ shippoAPIBaseURL = "https://api.goshippo.com/v1"
17+ shippoAPIBaseURLNoVersion = "https://api.goshippo.com"
1718)
1819
1920type Client struct {
@@ -41,7 +42,17 @@ func (c *Client) SetTraceLogger(logger *log.Logger) *log.Logger {
4142}
4243
4344func (c * Client ) do (method , path string , input , output interface {}, headers map [string ]string ) error {
44- url := shippoAPIBaseURL + path
45+ return c ._do (shippoAPIBaseURL , method , path , input , output , headers )
46+ }
47+
48+ // doWithoutVersion was added to support the /shippo-accounts endpoint that throws a 404 if `/v1/` is present
49+ // https://docs.goshippo.com/docs/platformaccounts/platform_using_accounts/#create-a-managed-shippo-account-for-your-customer
50+ func (c * Client ) doWithoutVersion (method , path string , input , output interface {}, headers map [string ]string ) error {
51+ return c ._do (shippoAPIBaseURLNoVersion , method , path , input , output , headers )
52+ }
53+
54+ func (c * Client ) _do (baseUrl , method , path string , input , output interface {}, headers map [string ]string ) error {
55+ url := baseUrl + path
4556
4657 req , err := c .createRequest (method , url , input , headers )
4758 if err != nil {
@@ -105,8 +116,10 @@ func (c *Client) createRequest(method, url string, bodyObject interface{}, heade
105116 }
106117
107118 for hk , hva := range req .Header {
108- for _ , hv := range hva {
109- c .logPrintf ("Client.createRequest() Header %s=%s" , hk , hv )
119+ if hk != "Authorization" {
120+ for _ , hv := range hva {
121+ c .logPrintf ("Client.createRequest() Header %s=%s" , hk , hv )
122+ }
110123 }
111124 }
112125
0 commit comments