Answer the question
In order to leave comments, you need to log in
How to add a specific header to a request?
I am writing tests for my django application, I need to pass a custom header through the Client object. How?
PS: I know about
from django.test.client import Client
self.c = Client(enforce_csrf_checks=False)
header = {
"jwt": self.ficti_JWT
}
resp = self.c.post('/api/new_pass/', {
"encode_pass": "UmVhbCBkYXRh",
"sign_pass": "Li4uYnV0LCBub3Qgd29ya2luZw==",
"comment_pass": "The data, but now it works! (NO)",
}, headers=header)
, does not work.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question