Add Body
This module provides an example of Add Body.
- class callouts.python.extproc.example.add_body.service_callout_example.CalloutServerExample(*args: Any, **kwargs: Any)[source]
Bases:
CalloutServer
Example callout server showing how to add text to a callout body.
For request body callouts we return a mutation to append ‘-added-body’ to the body. For response body callouts we send a mutation to replace the body with ‘new-body’.
- on_request_body(body: envoy.service.ext_proc.v3.external_processor_pb2.HttpBody, context: ServicerContext) envoy.service.ext_proc.v3.external_processor_pb2.BodyResponse [source]
Custom processor on the request body.
- Parameters:
body (service_pb2.BodyResponse) – The HTTP body received in the request.
context (ServicerContext) – The context object for the gRPC service.
- Returns:
The response containing the mutations to be applied to the request body.
- Return type:
service_pb2.BodyResponse
- on_response_body(body: envoy.service.ext_proc.v3.external_processor_pb2.HttpBody, context: ServicerContext) envoy.service.ext_proc.v3.external_processor_pb2.BodyResponse [source]
Custom processor on the response body.
- Parameters:
body (service_pb2.BodyResponse) – The HTTP body received in the response.
context (ServicerContext) – The context object for the gRPC service.
- Returns:
The response containing the mutations to be applied to the response body.
- Return type:
service_pb2.BodyResponse