
    _f                     >    d dl mZmZ d dlmZ  G d de          ZdS )    )unquoteurlparse)ApplicationCommunicatorc                   ,     e Zd ZdZd fd	ZddZ xZS )	HttpCommunicatora-  
    ApplicationCommunicator subclass that has HTTP shortcut methods.

    It will construct the scope for you, so you need to pass the application
    (uninstantiated) along with HTTP parameters.

    This does not support full chunking - for that, just use ApplicationCommunicator
    directly.
        Nc                 V   t          |          }dd|                                t          |j                  |j                            d          |pg d| _        t          |t                    sJ || _	        d| _
        t                                          || j                   d S )Nhttpz1.1zutf-8)typehttp_versionmethodpathquery_stringheadersF)r   upperr   r   queryencodescope
isinstancebytesbodysent_requestsuper__init__)selfapplicationr   r   r   r   parsed	__class__s          G/var/www/html/env/lib/python3.11/site-packages/channels/testing/http.pyr   zHttpCommunicator.__init__   s    $!llnnFK(("L//88}"
 

 $&&&&&	!dj11111r      c                   K   | j         s*d| _         |                     d| j        d           d{V  |                     |           d{V }|d         dk    sJ d|d<   	 |                     |           d{V }|d         d	k    sJ t	          |d         t
                    sJ |dxx         |d         z  cc<   |                    d
d          snt|d= |                    dg            |S )zu
        Get the application's response. Returns a dict with keys of
        "body", "headers" and "status".
        Tzhttp.request)r   r   Nr   zhttp.response.startr   r   zhttp.response.body	more_bodyFr   )r   
send_inputr   receive_outputr   r   get
setdefault)r   timeoutresponse_startchunks       r   get_responsezHttpCommunicator.get_response    sN        	O $D//>49"M"MNNNNNNNNN#227;;;;;;;;f%)>>>>>!$v	--g66666666E=$88888eFmU333336"""eFm3"""99[%00 	 6"!!)R000r   )r   N)r    )__name__
__module____qualname____doc__r   r*   __classcell__)r   s   @r   r   r      s[         2 2 2 2 2 2       r   r   N)urllib.parser   r   asgiref.testingr   r    r   r   <module>r3      sd    * * * * * * * * 3 3 3 3 3 32 2 2 2 2. 2 2 2 2 2r   