Exemplo n.º 1
0
        def get_set_cookie(request):
            value = str(request.params.get('value', 'not-set'))

            response = JsonResponse({
                'message': 'Cookie was set to {:s}.'.format(value)
            })
            response.set_cookie('poort-cookie', value)
            return response
Exemplo n.º 2
0
        def get_set_multiple_cookies(request):
            response = JsonResponse({
                'message': 'Setting 10 cookies!'
            })

            for i in range(10):
                response.set_cookie('poort-cookie-{:d}'.format(i), str(i))

            return response