Add cookie handling for http client #2534
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In one of our integrations, we have the challenge, that every call of our http output must contain a
csrf
token plus a set of cookies, because the receiving server is not truly stateless.Therefore we're calling a
get token
method via branch processor to receive the token and all necessary cookies, like a loadbalancer session id etc..Unfortunately, Benthos currently does not accept multiple http headers with the same name properly, which is especially problematic for the
Set-Cookie
header.This PR does not change the handling of headers in general, but it introduces a new Metadata field called
Cookie
which aggregates all incomingSet-Cookie
headers in a ready-to-useCookie
value for subsequent calls.Example Inbound:
Resulting Metadata:
Since this would add a new metadata field whenever cookie headers are sent by the server,
I'm not sure if this would need a separate config flag to disable this feature. Or if it even must be off by default?