library/common/extensions/filters/http/local_error/filter.cc
void mapLocalHttpResponseToError(uint64_t status, Http::ResponseHeaderMap& headers) {
  switch (status) {
  case 408:
    headers.addCopy(Http::InternalHeaders::get().ErrorCode, std::to_string(ENVOY_REQUEST_TIMEOUT));
    break;
  case 413:
    headers.addCopy(Http::InternalHeaders::get().ErrorCode,
                    std::to_string(ENVOY_BUFFER_LIMIT_EXCEEDED));
    break;
  case 503:
    headers.addCopy(Http::InternalHeaders::get().ErrorCode,
                    std::to_string(ENVOY_CONNECTION_FAILURE));
    break;
  default:
    headers.addCopy(Http::InternalHeaders::get().ErrorCode, std::to_string(ENVOY_UNDEFINED_ERROR));
  }

  headers.setStatus(218);
}
// Envoy Mobile surfaces non-"OK" local responses as errors via callbacks rather than an HTTP
// response. Here that response's "real" status code is mapped to an Envoy Mobile error code
// which is passed through the response chain as a header. The status code is updated with
// the sentinel value, 218 ("This is fine").
Envoy Mobile surfaces non-"OK" local responses as errors via callbacks rather than an HTTP
response. Here that response's "real" status code is mapped to an Envoy Mobile error code
which is passed through the response chain as a header. The status code is updated with
the sentinel value, 218 ("This is fine").
Envoy Mobile surfaces non - " OK " local responses as errors via callbacks rather than an HTTP response . Here that response ' s " real " status code is mapped to an Envoy Mobile error code which is passed through the response chain as a header . The status code is updated with the sentinel value 218 ( " This is fine " ) .
void mapLocalHttpResponseToError(uint64_t status, Http::ResponseHeaderMap& headers) {
  switch (status) {
  case 408:
    headers.addCopy(Http::InternalHeaders::get().ErrorCode, std::to_string(ENVOY_REQUEST_TIMEOUT));
    break;
  case 413:
    headers.addCopy(Http::InternalHeaders::get().ErrorCode,
                    std::to_string(ENVOY_BUFFER_LIMIT_EXCEEDED));
    break;
  case 503:
    headers.addCopy(Http::InternalHeaders::get().ErrorCode,
                    std::to_string(ENVOY_CONNECTION_FAILURE));
    break;
  default:
    headers.addCopy(Http::InternalHeaders::get().ErrorCode, std::to_string(ENVOY_UNDEFINED_ERROR));
  }
  headers.setStatus(218);
}
void mapLocalHttpResponseToError ( uint64_t status , Http :: ResponseHeaderMap & headers ) { switch ( status ) { case 408 : headers . addCopy ( Http :: InternalHeaders :: get ( ) . ErrorCode , std :: to_string ( ENVOY_REQUEST_TIMEOUT ) ) ; break ; case 413 : headers . addCopy ( Http :: InternalHeaders :: get ( ) . ErrorCode , std :: to_string ( ENVOY_BUFFER_LIMIT_EXCEEDED ) ) ; break ; case 503 : headers . addCopy ( Http :: InternalHeaders :: get ( ) . ErrorCode , std :: to_string ( ENVOY_CONNECTION_FAILURE ) ) ; break ; default : headers . addCopy ( Http :: InternalHeaders :: get ( ) . ErrorCode , std :: to_string ( ENVOY_UNDEFINED_ERROR ) ) ; } headers . setStatus ( 218 ) ; }
Envoy Mobile surfaces non-"OK" local responses as errors via callbacks rather than an HTTP
response.
Envoy Mobile surfaces non - " OK " local responses as errors via callbacks rather than an HTTP response .