o
    Ì¿SiQ  ã                   @   s8   d dl mZ d dlmZ d dlmZ G dd„ deƒZdS )é    )Újsonable_encoder)ÚJSONResponse)Úsanitize_for_jsonc                       s&   e Zd ZdZdef‡ fdd„Z‡  ZS )ÚSanitizedJSONResponsezÜJSONResponse that guarantees JSON-compliant output.

    Starlette JSONResponse uses `allow_nan=False`, so NaN/Inf will raise.
    This response class sanitizes the content (after jsonable_encoder) to avoid crashes.
    Úreturnc                    s   t |ƒ}t|ƒ}tƒ  |¡S )N)r   r   ÚsuperÚrender)ÚselfÚcontentÚencodedÚ	sanitized©Ú	__class__© ú1/var/www/html/Trade-python/app/utils/responses.pyr      s   zSanitizedJSONResponse.render)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úbytesr   Ú__classcell__r   r   r   r   r      s    r   N)Úfastapi.encodersr   Úfastapi.responsesr   Úapp.utils.json_sanitizer   r   r   r   r   r   Ú<module>   s    