Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.
This repository was archived by the owner on May 21, 2025. It is now read-only.

Why all headers values are split as they are comma separated in EventToRequest? #171

Open
@arabello

Description

@arabello

I had an issue while integrating a custom header containing a comma , caused by RequestAccessorV2.EventToRequestWithContext: the request returned has the custom header value as an array of two strings (original value split into two parts) instead of an array of a single element (the entire value with the comma).

Looking at the code, it seems that the RequestAccessor splits headers values treating them as they all are comma-separated.

for headerKey, headerValue := range req.Headers {
    for _, val := range strings.Split(headerValue, ",") {
        httpRequest.Header.Add(headerKey, strings.Trim(val, " "))
    }
}

Why so? If an header is not defined as comma-separated no splitting strategy should occur, shouldn't it? What am I missing?

Moreover, why this behavior differs from the RequestAccessor (V1)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions