Basic Callout Server

This module provides an example of a basic callout server.

class callouts.python.extproc.example.basic_callout_server.BasicCalloutServer(*args: Any, **kwargs: Any)[source]

Bases: CalloutServer

Example callout server.

A non-comprehensive set of examples for each of the possible callout actions.

on_request_body(body: envoy.service.ext_proc.v3.external_processor_pb2.HttpBody, _) envoy.service.ext_proc.v3.external_processor_pb2.BodyResponse[source]

Custom processor on the request body.

Generates a request body modification replacing the request body with ‘replaced-body’.

on_request_headers(headers: envoy.service.ext_proc.v3.external_processor_pb2.HttpHeaders, _) envoy.service.ext_proc.v3.external_processor_pb2.HeadersResponse[source]

Custom processor on request headers.

This example contains a few of the possible modifications that can be applied to a request header callout:

  • A change to the ‘:authority’ and ‘:path’ headers.

  • Adding the header ‘header-request’ with the value of ‘request’.

  • Removal of a header ‘foo’.

  • Clearing of the route cache.

on_response_body(body: envoy.service.ext_proc.v3.external_processor_pb2.HttpBody, _) envoy.service.ext_proc.v3.external_processor_pb2.BodyResponse[source]

Custom processor on the response body.

Generates a response body modification clearing the response body.

on_response_headers(headers: envoy.service.ext_proc.v3.external_processor_pb2.HttpHeaders, _) envoy.service.ext_proc.v3.external_processor_pb2.HeadersResponse[source]

Custom processor on response headers.

Generates an addition to the response headers containing: ‘hello: service-extensions’.