[Answered ]-Django Rest Framework not passing 'X_USERNAME' on request – authenticate method param

2👍

It is looking for a custom request header named ‘X_USERNAME’.

So you need to define the user in a custom request header called X_USERNAME in your HTTpie request…

I think that if you have the username ‘user’ then you should try sending it as this:

http 127.0.0.1 X_USERNAME:user

HTTP headers

To set custom headers you can use the Header:Value notation:

$ http example.org  User-Agent:PoopyPants  'Cookie:valued-visitor=yes;whatever=whatever;etc=etc'  \
    X_USERNAME:user  Referer:http://stackoverflow.com/


GET / HTTP/1.1
Accept: */*

Accept-Encoding: gzip, deflate
Cookie: valued-visitor=yes;whatever=whatever;etc=etc
Host: 127.0.0.1
Referer: http://stackoverflow.com/
User-Agent: PoopyPants
X_USERNAME: user
👤Tim

Leave a comment