From 44e6eb4f5b5af9d8adbd62179ec4cdbd83dee9d9 Mon Sep 17 00:00:00 2001 From: anna-cross Date: Thu, 7 Mar 2024 14:03:25 -0500 Subject: [PATCH] Only add auth token once --- cmd/meroxa/global/basic_client.go | 14 +++++++++-- go.mod | 2 +- .../pkg/server/testdata/opencdc_record.json | 25 ------------------- 3 files changed, 13 insertions(+), 28 deletions(-) delete mode 100644 vendor/github.com/meroxa/turbine-core/v2/pkg/server/testdata/opencdc_record.json diff --git a/cmd/meroxa/global/basic_client.go b/cmd/meroxa/global/basic_client.go index 660082b6d..4c21011ec 100644 --- a/cmd/meroxa/global/basic_client.go +++ b/cmd/meroxa/global/basic_client.go @@ -243,7 +243,12 @@ func (c *client) newRequestMultiPart( if err != nil { return nil, err } - req.Header.Set("Authorization", accessToken) + if _, exists := req.Header["Authorization"]; !exists { + + req.Header.Set("Authorization", accessToken) + + } + fmt.Println("Content-Type header already set.") } req.Header.Set("User-Agent", c.userAgent) @@ -303,7 +308,12 @@ func (c *client) newRequest( if err != nil { return nil, err } - req.Header.Add("Authorization", accessToken) + if _, exists := req.Header["Authorization"]; !exists { + + req.Header.Set("Authorization", accessToken) + + } + fmt.Println("Content-Type header already set.") } req.Header.Add("Content-Type", jsonContentType) req.Header.Add("Accept", jsonContentType) diff --git a/go.mod b/go.mod index 3bc67b720..ca2c88d65 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/meroxa/cli -go 1.22.0 +go 1.22.1 require ( github.com/alexeyco/simpletable v0.0.0-20200730140406-5bb24159ccfb diff --git a/vendor/github.com/meroxa/turbine-core/v2/pkg/server/testdata/opencdc_record.json b/vendor/github.com/meroxa/turbine-core/v2/pkg/server/testdata/opencdc_record.json deleted file mode 100644 index 9107bb706..000000000 --- a/vendor/github.com/meroxa/turbine-core/v2/pkg/server/testdata/opencdc_record.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "position": "cG9zaXRpb24tMQ==", - "operation": "create", - "metadata": { - "conduit.source.connector.id": "connector-1", - "opencdc.readAt": "1703019966257132000", - "opencdc.version": "v1" - }, - "key": { - "id": 1 - }, - "payload": { - "before": {}, - "after": { - "category": "Electronics", - "customer_email": "customer1@example.com", - "id": 1, - "product_id": 101, - "product_name": "Example Laptop 1", - "product_type": "Laptop", - "shipping_address": "123 Main St, Cityville", - "stock": true - } - } -}