T
T
The-TS2021-01-18 20:14:02
Django
The-TS, 2021-01-18 20:14:02

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

1 answer(s)
D
Dr. Bacon, 2021-01-18
@bacon

ok google, "python requests add header"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question