Skip to content

How to invoke decodeData in a header-only request? #36692

@Octopus409

Description

@Octopus409

I am writing a filter that can inject some data into body even it's a header-only request.
I have tried call addDecodedData in decodeHeader() to add some data, but decodeData() has not been called later in the same filter. It seems that this will only take effect in subsequent filters.

I try addDecodeData in decodeHeader() look like this.

if(end_stream){
    // for header-only request, add an empty body frame to trigger decodeData()
    Envoy::Buffer::OwnedImpl buffer{"mark"};
    decoder_callbacks_->addDecodedData(buffer, true);
}
return  Http::FilterHeadersStatus::StopIteration;

I'm not sure if my understanding of addDecodedData is correct. Maybe I should add data in the previous filter and then my custom filter will invoke decodeData? Is there any way to invoke decodeData in the same filter?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestions that are neither investigations, bugs, nor enhancements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions