Skip to content

Commit

Permalink
Add content-length to http channel (dapr#7537)
Browse files Browse the repository at this point in the history
* add content-length to http channel

Signed-off-by: yaron2 <schneider.yaron@live.com>

* update tests

Signed-off-by: yaron2 <schneider.yaron@live.com>

---------

Signed-off-by: yaron2 <schneider.yaron@live.com>
  • Loading branch information
yaron2 authored Feb 14, 2024
1 parent a512f1f commit 6dea5b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
4 changes: 1 addition & 3 deletions pkg/messaging/v1/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ func InternalMetadataToHTTPHeader(ctx context.Context, internalMD DaprInternalMe
continue
}

if strings.HasSuffix(keyName, gRPCBinaryMetadataSuffix) ||
keyName == ContentTypeHeader ||
keyName == ContentLengthHeader {
if strings.HasSuffix(keyName, gRPCBinaryMetadataSuffix) || keyName == ContentTypeHeader {
continue
}

Expand Down
11 changes: 3 additions & 8 deletions tests/e2e/pubsub/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,7 @@ func testPublish(t *testing.T, publisherExternalURL string, protocol string) rec
require.NoError(t, err)
offset += numberOfMessagesToPublish + 1

// Test bug where content-length metadata conflict makes message undeliverable in grpc subscriber.
// We set an arbitrarily large number that it is unlikely to match the size of the payload daprd delivers.
metadataContentLengthConflict := map[string]string{
"content-length": "9999999",
}
sentTopicAMessages, err := sendToPublisher(t, publisherExternalURL, "pubsub-a-topic", protocol, metadataContentLengthConflict, "")
sentTopicAMessages, err := sendToPublisher(t, publisherExternalURL, "pubsub-a-topic", protocol, nil, "")
require.NoError(t, err)
offset += numberOfMessagesToPublish + 1

Expand All @@ -295,10 +290,10 @@ func testPublish(t *testing.T, publisherExternalURL string, protocol string) rec
require.NoError(t, err)
offset += numberOfMessagesToPublish + 1

metadataRawPayload := map[string]string{
metadata := map[string]string{
"rawPayload": "true",
}
sentTopicRawMessages, err := sendToPublisher(t, publisherExternalURL, "pubsub-raw-topic", protocol, metadataRawPayload, "")
sentTopicRawMessages, err := sendToPublisher(t, publisherExternalURL, "pubsub-raw-topic", protocol, metadata, "")
require.NoError(t, err)
offset += numberOfMessagesToPublish + 1

Expand Down

0 comments on commit 6dea5b9

Please sign in to comment.