Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.07 KB

response_header_transforms.md

File metadata and controls

31 lines (23 loc) · 1.07 KB

ResponseEntry::responseHeaderTransforms API

Overview

ResponseEntry::responseHeaderTransforms allows filters to obtain response header transformations that would be applied by ResponseEntry::finalizeResponseHeaders.

If you do not have full knowledge that there will be no further route modifications later in the filter chain, you should not use this API.

Usage

To obtain the response header transformations at request time:

Http::FilterHeadersStatus MyFilter::decodeHeaders(
    Http::RequestHeaderMap& headers, bool) {
  auto transforms =
      decoder_callbacks_->route()->routeEntry()->responseHeaderTransforms(
          decoder_callbacks_->streamInfo());

  // Send the response headers back to the client; they will process them later.
  decoder_callbacks_->sendLocalReply(
      Envoy::Http::Code::OK, MySerializedTransforms(transforms), nullptr, Envoy::Grpc::Status::Ok,
      "local_reply");
}

If you want to retrieve the original values rather than the formatted ones, pass /*do_formatting=*/false as the second argument to responseHeaderTransforms.