@@ -408,7 +408,7 @@ The `coreapi` library, and the `schema` object will now both be available on the
408
408
409
409
In order to interact with the API you'll need a client instance.
410
410
411
- var client = coreapi.Client()
411
+ var client = new coreapi.Client()
412
412
413
413
Typically you'll also want to provide some authentication credentials when
414
414
instantiating the client.
@@ -423,7 +423,7 @@ the user to login, and then instantiate a client using session authentication:
423
423
csrfCookieName: 'csrftoken',
424
424
csrfHeaderName: 'X-CSRFToken'
425
425
})
426
- let client = coreapi.Client({auth: auth})
426
+ let client = new coreapi.Client({auth: auth})
427
427
428
428
The authentication scheme will handle including a CSRF header in any outgoing
429
429
requests for unsafe HTTP methods.
@@ -437,7 +437,7 @@ The `TokenAuthentication` class can be used to support REST framework's built-in
437
437
scheme: 'JWT'
438
438
token: '<token>'
439
439
})
440
- let client = coreapi.Client({auth: auth})
440
+ let client = new coreapi.Client({auth: auth})
441
441
442
442
When using TokenAuthentication you'll probably need to implement a login flow
443
443
using the CoreAPI client.
@@ -448,7 +448,7 @@ request to an "obtain token" endpoint
448
448
For example, using the "Django REST framework JWT" package
449
449
450
450
// Setup some globally accessible state
451
- window.client = coreapi.Client()
451
+ window.client = new coreapi.Client()
452
452
window.loggedIn = false
453
453
454
454
function loginUser(username, password) {
@@ -475,7 +475,7 @@ The `BasicAuthentication` class can be used to support HTTP Basic Authentication
475
475
username: '<username>',
476
476
password: '<password>'
477
477
})
478
- let client = coreapi.Client({auth: auth})
478
+ let client = new coreapi.Client({auth: auth})
479
479
480
480
## Using the client
481
481
0 commit comments