async def postprocess(self, *, context: EventContext, payload: Optional[EventPayload], response: PostprocessHook) -> Optional[EventPayload]: response.set_header("PluginHeader", "PluginHeaderValue") response.set_cookie("PluginCookie", "PluginCookieValue") response.set_status(999) return payload
async def __postprocess__(payload: Something, context: EventContext, response: PostprocessHook) -> str: # noqa: C0103 assert context.event_info.write_stream msg = f"events submitted to stream: {context.event_info.write_stream.name}" logger.info(context, msg) response.set_header("X-Stream-Name", context.event_info.write_stream.name) return msg
async def __postprocess__(img_file: ImagePng, context: EventContext, *, response: PostprocessHook) -> str: response.set_header("Content-Disposition", f"attachment; filename={img_file.file_name}") response.set_content_type(img_file.content_type) response.set_file_response(path=img_file.file_path) return img_file.file_name
async def __postprocess__(path: str, context: EventContext, *, response: PostprocessHook) -> str: file_name = Path(path).name response.set_header("Content-Disposition", f"attachment; filename={file_name}") response.set_header("Content-Type", 'text/plain') response.set_file_response(path=path) return path
async def __postprocess__(payload: str, context: EventContext, response: PostprocessHook) -> str: if payload.startswith('ok:'): response.set_status(200) response.set_header('X-Status', 'ok') response.set_cookie('Test-Cookie', 'ok') else: response.set_status(400) return payload
async def __postprocess__(img_file: ImagePng, context: EventContext, response: PostprocessHook) -> str: if os.path.isfile(img_file.file_path): response.set_header('Content-Disposition', f'attachment; filename="{img_file.file_name}"') response.set_content_type(img_file.content_type) response.set_file_response(img_file.file_path) return f"File {img_file.file_name}" response.set_status(400) return f"File {img_file.file_name} not found"
async def __postprocess__(payload: MockData, context: EventContext, response: PostprocessHook) -> MockData: response.set_header('recognized', payload.value) return payload
async def __postprocess__(payload: str, context: EventContext, *, response: PostprocessHook) -> str: response.set_header("PluginHeader", "PluginHeaderValue") response.set_cookie("PluginCookie", "PluginCookieValue") response.set_status(999) return "PluginEvent.postprocess"