Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
Django how to see the cookies being set and unset?

I'm using response.set_cookie() to set cookies and response_delete_cookie() to delete it.

I'd like to see if things are working as intended, but I don't know where to look for the cookies being set.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

In your views do this.

...
request.COOKIES.get('cookie_name', None)
...

To get the cookie or None.

over 4 years ago · Santiago Trujillo Report

0

I'd like to see if things are working as intended

Sounds like the perfect time to add some tests! Here's something to get you started:

from django.test import TestCase
from django import shortcuts


class TestCookies(TestCase):

    def test_cookie_added(self):
        url = shortcuts.reverse('your-view')
        response = self.client.get(url)
        self.assertEqual(response.cookies.get('cookie_name'), 'expected')

    def test_cookie_removed(self):
        url = shortcuts.reverse('your-cookie-deleting-view')
        response = self.client.get(url)
        self.assertIsNone(response.cookies.get('cookie_name'))
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!