@@ -19,7 +19,9 @@ func (c *ClientTest) CreateReport(report Report) (*Report, error) {
1919 log .Print ("Report body----------------" )
2020 log .Println (string (rb ))
2121
22- req , err := http .NewRequest ("POST" , fmt .Sprintf ("%s/analytics/v1/reports?customerContext=%s" , c .HostURL , c .Auth .CustomerContext ), strings .NewReader (string (rb )))
22+ urlRequestBase := fmt .Sprintf ("%s/analytics/v1/reports" , c .HostURL )
23+ urlRequestContext := addContextToURL (c .Auth .CustomerContext , urlRequestBase )
24+ req , err := http .NewRequest ("POST" , urlRequestContext , strings .NewReader (string (rb )))
2325 log .Println ("URL----------------" )
2426 log .Println (req .URL )
2527 if err != nil {
@@ -53,7 +55,9 @@ func (c *ClientTest) UpdateReport(reportID string, report Report) (*Report, erro
5355 }
5456 log .Print ("Report body----------------" )
5557 log .Println (string (rb ))
56- req , err := http .NewRequest ("PATCH" , fmt .Sprintf ("%s/analytics/v1/reports/%s?customerContext=%s" , c .HostURL , reportID , c .Auth .CustomerContext ), strings .NewReader (string (rb )))
58+ urlRequestBase := fmt .Sprintf ("%s/analytics/v1/reports/%s" , c .HostURL , reportID )
59+ urlRequestContext := addContextToURL (c .Auth .CustomerContext , urlRequestBase )
60+ req , err := http .NewRequest ("PATCH" , urlRequestContext , strings .NewReader (string (rb )))
5761 if err != nil {
5862 return nil , err
5963 }
@@ -75,7 +79,9 @@ func (c *ClientTest) UpdateReport(reportID string, report Report) (*Report, erro
7579}
7680
7781func (c * ClientTest ) DeleteReport (reportID string ) error {
78- req , err := http .NewRequest ("DELETE" , fmt .Sprintf ("%s/analytics/v1/reports/%s?customerContext=%s" , c .HostURL , reportID , c .Auth .CustomerContext ), nil )
82+ urlRequestBase := fmt .Sprintf ("%s/analytics/v1/reports/%s" , c .HostURL , reportID )
83+ urlRequestContext := addContextToURL (c .Auth .CustomerContext , urlRequestBase )
84+ req , err := http .NewRequest ("DELETE" , urlRequestContext , nil )
7985 if err != nil {
8086 return err
8187 }
@@ -91,7 +97,10 @@ func (c *ClientTest) DeleteReport(reportID string) error {
9197
9298// GetReport - Returns a specifc report
9399func (c * ClientTest ) GetReport (orderID string ) (* Report , error ) {
94- req , err := http .NewRequest ("GET" , fmt .Sprintf ("%s/analytics/v1/reports/%s/config?customerContext=%s" , c .HostURL , orderID , c .Auth .CustomerContext ), nil )
100+
101+ urlRequestBase := fmt .Sprintf ("%s/analytics/v1/reports/%s/config" , c .HostURL , orderID )
102+ urlRequestContext := addContextToURL (c .Auth .CustomerContext , urlRequestBase )
103+ req , err := http .NewRequest ("GET" , urlRequestContext , nil )
95104 if err != nil {
96105 return nil , err
97106 }
0 commit comments