Exemple #1
0
from falcon.errors import HeaderNotSupported
from falcon.media import Handlers
from falcon.response_helpers import (
    format_content_disposition,
    format_etag_header,
    format_header_value_list,
    format_range,
    header_property,
    is_ascii_encodable,
)
from falcon.util import dt_to_http, http_cookies, structures, TimezoneGMT
from falcon.util.deprecation import deprecated
from falcon.util.uri import encode as uri_encode
from falcon.util.uri import encode_value as uri_encode_value

GMT_TIMEZONE = TimezoneGMT()

_STREAM_LEN_REMOVED_MSG = (
    'The deprecated stream_len property was removed in Falcon 3.0. '
    'Please use Response.set_stream() or Response.content_length instead.')

_RESERVED_CROSSORIGIN_VALUES = frozenset({'anonymous', 'use-credentials'})

_RESERVED_SAMESITE_VALUES = frozenset({'lax', 'strict', 'none'})


class Response:
    """Represents an HTTP response to a client request.

    Note:
        ``Response`` is not meant to be instantiated directly by responders.
Exemple #2
0
def test_cookie_timezone(client):
    tz = TimezoneGMT()
    assert tz.tzname(timedelta(0)) == 'GMT'
Exemple #3
0
 def test_cookie_timezone(self):
     tz = TimezoneGMT()
     self.assertEqual("GMT", tz.tzname(timedelta(0)))
Exemple #4
0
 def test_cookie_timezone(self):
     tz = TimezoneGMT()
     self.assertEqual('GMT', tz.tzname(timedelta(0)))
Exemple #5
0
def test_cookie_timezone(client):
    tz = TimezoneGMT()
    assert tz.tzname(timedelta(0)) == 'GMT'