File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
packages/service-library/src/servicelib Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 77from models_library .rest_error import ErrorGet , ErrorItemType
88
99from ..aiohttp .status import HTTP_200_OK
10- from ..mimetype_constants import MIMETYPE_APPLICATION_JSON
10+ from ..mimetype_constants import MIMETYPE_APPLICATION_JSON , MIMETYPE_TEXT_EVENT_STREAM
1111from ..rest_constants import RESPONSE_MODEL_POLICY
1212from ..rest_responses import is_enveloped
1313from ..status_codes_utils import get_code_description , get_code_display_name , is_error
@@ -41,7 +41,7 @@ def create_event_stream_response(event_generator: Any) -> web.Response:
4141 body = event_generator (),
4242 status = HTTP_200_OK ,
4343 reason = get_code_description (HTTP_200_OK ),
44- content_type = "text/event-stream" ,
44+ content_type = MIMETYPE_TEXT_EVENT_STREAM ,
4545 headers = {"Cache-Control" : "no-cache" , "Connection" : "keep-alive" },
4646 )
4747
Original file line number Diff line number Diff line change 77
88SEE https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
99"""
10+
1011from typing import Final
1112
1213# NOTE: mimetypes (https://docs.python.org/3/library/mimetypes.html) is already a module in python
1314
1415MIMETYPE_APPLICATION_JSON : Final [str ] = "application/json"
1516MIMETYPE_APPLICATION_ND_JSON : Final [str ] = "application/x-ndjson"
1617MIMETYPE_APPLICATION_ZIP : Final [str ] = "application/zip"
18+ MIMETYPE_TEXT_EVENT_STREAM : Final [str ] = "text/event-stream"
1719MIMETYPE_TEXT_HTML : Final [str ] = "text/html"
1820MIMETYPE_TEXT_PLAIN : Final [str ] = "text/plain"
You can’t perform that action at this time.
0 commit comments