Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sync 1.33.1 to master #5071

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.33.1](https://github.com/rudderlabs/rudder-server/compare/v1.33.0...v1.33.1) (2024-09-06)


### Bug Fixes

* revert support for webhook headers ([#5064](https://github.com/rudderlabs/rudder-server/issues/5064)) ([56eca34](https://github.com/rudderlabs/rudder-server/commit/56eca3475e24ab9ba12624d2b4015c9d15be7249))

## [1.33.0](https://github.com/rudderlabs/rudder-server/compare/v1.32.0...v1.33.0) (2024-09-02)


Expand Down
6 changes: 3 additions & 3 deletions gateway/webhook/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ func TestIntegrationWebhook(t *testing.T) {
Name: "source_id",
Value: sourceID,
}},
JobsLimit: 10,
JobsLimit: 1,
})
require.NoError(t, err)
return len(r.Jobs) == len(tc.Output.ErrQueue)
return err == nil && len(r.Jobs) == len(tc.Output.ErrQueue)
}, time.Second, time.Millisecond*10)

require.NoError(t, err)
assert.Len(t, r.Jobs, len(tc.Output.ErrQueue))
for i, p := range tc.Output.ErrQueue {
errPayload, err := json.Marshal(struct {
Expand Down
20 changes: 0 additions & 20 deletions gateway/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,6 @@ func (webhook *HandleT) batchRequests(sourceDef string, requestQ chan *webhookT)
}
}

func getXHeaders(req *http.Request) map[string]string {
xHeaders := make(map[string]string)
for key, values := range req.Header {
lowerCaseKey := strings.ToLower(key)
if !strings.HasPrefix(lowerCaseKey, "x-forwarded-") && strings.HasPrefix(lowerCaseKey, "x-") {
xHeaders[key] = strings.Join(values, ",")
}
}
return xHeaders
}

func prepareRequestBody(req *http.Request, sourceType string, sourceListForParsingParams []string) ([]byte, error) {
defer func() {
_ = req.Body.Close()
Expand All @@ -303,15 +292,6 @@ func prepareRequestBody(req *http.Request, sourceType string, sourceListForParsi
}
}

xHeaders := getXHeaders(req)
if len(xHeaders) > 0 {
body, err = sjson.SetBytes(body, "headers", xHeaders)
if err != nil {
return nil, errors.New(response.InvalidJSON)
}

}

return body, nil
}

Expand Down
6 changes: 0 additions & 6 deletions gateway/webhook/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,6 @@ func TestPrepareRequestBody(t *testing.T) {
sourceType: "shopify",
expectedResponse: `{"key":"value","query_parameters":{}}`,
},
{
name: "Some payload with headers for shopify",
req: createRequest(requestOpts{method: http.MethodPost, target: "http://example.com", body: strings.NewReader(`{"key":"value"}`), headers: map[string]string{"X-Key": "header-value"}}),
sourceType: "shopify",
expectedResponse: `{"key":"value","query_parameters":{},"headers":{"X-Key":"header-value"}}`,
},
{
name: "Some payload with query parameters for Adjust",
req: createRequest(requestOpts{method: http.MethodPost, target: "http://example.com", body: strings.NewReader(`{"key1":"value1"}`), params: map[string]string{"key2": "value2"}}),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ require (
github.com/rudderlabs/rudder-go-kit v0.39.2
github.com/rudderlabs/rudder-observability-kit v0.0.3
github.com/rudderlabs/rudder-schemas v0.5.1
github.com/rudderlabs/rudder-transformer/go v0.0.0-20240903092449-3f2a5a664d32
github.com/rudderlabs/rudder-transformer/go v0.0.0-20240906042448-f7783d8fb300
github.com/rudderlabs/sql-tunnels v0.1.7
github.com/rudderlabs/sqlconnect-go v1.9.0
github.com/samber/lo v1.47.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1140,8 +1140,8 @@ github.com/rudderlabs/rudder-observability-kit v0.0.3 h1:vZtuZRkGX+6rjaeKtxxFE2Y
github.com/rudderlabs/rudder-observability-kit v0.0.3/go.mod h1:6UjAh3H6rkE0fFLh7z8ZGQEQbKtUkRfhWOf/OUhfqW8=
github.com/rudderlabs/rudder-schemas v0.5.1 h1:g4I5wp2yA6ZWQZ1MjSNn4zby3XctG/TOgbYUW3dS4z4=
github.com/rudderlabs/rudder-schemas v0.5.1/go.mod h1:JoDTB9nCDXwRz+G+aYwP3Fj42HLssKARxsFFm+qqgb4=
github.com/rudderlabs/rudder-transformer/go v0.0.0-20240903092449-3f2a5a664d32 h1:hsvbOvwfA8wr9GjNBWuh3lZnpqMgIzLU7HNESB87wSg=
github.com/rudderlabs/rudder-transformer/go v0.0.0-20240903092449-3f2a5a664d32/go.mod h1:3NGitPz4pYRRZ6Xt09S+8hb0tHK/9pZcKJ3OgOTaSmE=
github.com/rudderlabs/rudder-transformer/go v0.0.0-20240906042448-f7783d8fb300 h1:SmOLUqSCCcYs8QXYdZlHXCSCw77xhQ6qjNBsSA3bDKI=
github.com/rudderlabs/rudder-transformer/go v0.0.0-20240906042448-f7783d8fb300/go.mod h1:3NGitPz4pYRRZ6Xt09S+8hb0tHK/9pZcKJ3OgOTaSmE=
github.com/rudderlabs/sql-tunnels v0.1.7 h1:wDCRl6zY4M5gfWazf7XkSTGQS3yjBzUiUgEMBIfHNDA=
github.com/rudderlabs/sql-tunnels v0.1.7/go.mod h1:5f7+YL49JHYgteP4rAgqKnr4K2OadB0oIpUS+Tt3sPM=
github.com/rudderlabs/sqlconnect-go v1.9.0 h1:icLgqvVQ15Vh+oP7epA0b0yK6sIzxRVwPlRzOoDNVRA=
Expand Down
Loading