@@ -65,7 +65,7 @@ func isValidJSON(s string) bool {
6565 return json .Unmarshal ([]byte (s ), & js ) == nil
6666}
6767
68- func makeRequest (ctx context.Context , method string , url string , body []byte , token string , tableName string ) (error , []byte ) {
68+ func makeRequest (ctx context.Context , method string , url string , body []byte , token string , tableName string ) ([]byte , error ) {
6969 // Build the request
7070 req , err := http .NewRequestWithContext (ctx , method , url , bytes .NewBuffer (body ))
7171 if err != nil {
@@ -95,9 +95,9 @@ func makeRequest(ctx context.Context, method string, url string, body []byte, to
9595 // Read and print response
9696 respBody , err := io .ReadAll (resp .Body )
9797 if resp .StatusCode >= 400 {
98- return fmt .Errorf ("ingest failed: %s — %s" , resp .Status , string (respBody )), nil
98+ return nil , fmt .Errorf ("ingest failed: %s — %s" , resp .Status , string (respBody ))
9999 }
100- return err , respBody
100+ return respBody , err
101101}
102102
103103var tableId uuid.UUID
@@ -154,7 +154,7 @@ func (p *HydrolixBackendConnector) Exec(ctx context.Context, query string, args
154154 if err != nil {
155155 return fmt .Errorf ("error marshalling create_table JSON: %v" , err )
156156 }
157- err , _ = makeRequest (ctx , "POST" , url , createTableJson , token , tableName )
157+ _ , err = makeRequest (ctx , "POST" , url , createTableJson , token , tableName )
158158 if err != nil {
159159 logger .ErrorWithCtx (ctx ).Msgf ("error making request: %v" , err )
160160 return err
@@ -166,7 +166,7 @@ func (p *HydrolixBackendConnector) Exec(ctx context.Context, query string, args
166166 return fmt .Errorf ("error marshalling transform JSON: %v" , err )
167167 }
168168
169- err , _ = makeRequest (ctx , "POST" , url , transformJson , token , tableName )
169+ _ , err = makeRequest (ctx , "POST" , url , transformJson , token , tableName )
170170 if err != nil {
171171 logger .ErrorWithCtx (ctx ).Msgf ("error making request: %v" , err )
172172 return err
@@ -179,7 +179,7 @@ func (p *HydrolixBackendConnector) Exec(ctx context.Context, query string, args
179179 return fmt .Errorf ("error marshalling ingest JSON: %v" , err )
180180 }
181181 url := fmt .Sprintf ("http://%s/ingest/event" , hdxHost )
182- err , _ = makeRequest (ctx , "POST" , url , ingestJson , token , tableName )
182+ _ , err = makeRequest (ctx , "POST" , url , ingestJson , token , tableName )
183183 if err != nil {
184184 logger .ErrorWithCtx (ctx ).Msgf ("error making request: %v" , err )
185185 return err
0 commit comments