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

[Bug] Duplicated content type in header when use kafka-http-connector #45

Closed
chenjr0719 opened this issue Dec 27, 2020 · 2 comments · Fixed by #170
Closed

[Bug] Duplicated content type in header when use kafka-http-connector #45

chenjr0719 opened this issue Dec 27, 2020 · 2 comments · Fixed by #170
Assignees
Labels
bug Something isn't working connector-kafka

Comments

@chenjr0719
Copy link
Contributor

Hi there, I found an issue in kafka-http-connector.

headers := http.Header{
"KEDA-Topic": {conn.connectorData.Topic},
"KEDA-Response-Topic": {conn.connectorData.ResponseTopic},
"KEDA-Error-Topic": {conn.connectorData.ErrorTopic},
"Content-Type": {conn.connectorData.ContentType},
"KEDA-Source-Name": {conn.connectorData.SourceName},
}
// Set the headers came from Kafka record
for _, h := range message.Headers {
headers.Add(string(h.Key), string(h.Value))
}

If the message header also specifies the same keys (ex: content-type), when it sends the request to the function might be broken because of the duplicate key.

I would like to know, is it possible to check the message header first, and if it doesn't contain the same key, we use the default value here?

@blackfly19
Copy link
Contributor

Hi @chenjr0719. Can you please provide the steps to reproduce the issue?

@soharab-ic
Copy link
Contributor

@chenjr0719 http.Header is of type map[string][]string. It can have a slice of values for every key. The Add method does not overwrite existing values, it appends new values to the slice associated with the key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working connector-kafka
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants