(
self, dash_app: Dash, package_name: str, fingerprinted_path: str
)
| 333 | return jsonify(obj) |
| 334 | |
| 335 | def serve_component_suites( |
| 336 | self, dash_app: Dash, package_name: str, fingerprinted_path: str |
| 337 | ): # noqa: ARG002 unused req preserved for interface parity |
| 338 | path_in_pkg, has_fingerprint = check_fingerprint(fingerprinted_path) |
| 339 | _validate.validate_js_path(dash_app.registered_paths, package_name, path_in_pkg) |
| 340 | extension = "." + path_in_pkg.split(".")[-1] |
| 341 | mimetype = mimetypes.types_map.get(extension, "application/octet-stream") |
| 342 | package = sys.modules[package_name] |
| 343 | dash_app.logger.debug( |
| 344 | "serving -- package: %s[%s] resource: %s => location: %s", |
| 345 | package_name, |
| 346 | getattr(package, "__version__", "unknown"), |
| 347 | path_in_pkg, |
| 348 | package.__path__, |
| 349 | ) |
| 350 | data = pkgutil.get_data(package_name, path_in_pkg) |
| 351 | headers = {} |
| 352 | if has_fingerprint: |
| 353 | headers["Cache-Control"] = "public, max-age=31536000" |
| 354 | |
| 355 | if Response is None: |
| 356 | raise RuntimeError("Quart not installed; cannot generate Response") |
| 357 | return Response(data, content_type=mimetype, headers=headers) |
| 358 | |
| 359 | def setup_component_suites(self, dash_app: Dash): |
| 360 | async def serve(package_name, fingerprinted_path): |
no test coverage detected