Update - RequestsClient needs fully qualified URLs

Note that the requests client requires you to pass fully qualified URLs.
This commit is contained in:
Çağıl 2018-04-25 19:11:15 +01:00 committed by GitHub
parent 2983f1c53a
commit 43c4a1fedb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -238,12 +238,12 @@ For example...
client = RequestsClient()
# Obtain a CSRF token.
response = client.get('/homepage/')
response = client.get('http://testserver/homepage/')
assert response.status_code == 200
csrftoken = response.cookies['csrftoken']
# Interact with the API.
response = client.post('/organisations/', json={
response = client.post('http://testserver/organisations/', json={
'name': 'MegaCorp',
'status': 'active'
}, headers={'X-CSRFToken': csrftoken})