Skip to content

Commit 3110635

Browse files
Carlton Gibsontomchristie
authored andcommitted
Update JS constructor syntax (#5332)
Fixes #5247
1 parent bf4b3ff commit 3110635

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/topics/api-clients.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ The `coreapi` library, and the `schema` object will now both be available on the
408408

409409
In order to interact with the API you'll need a client instance.
410410

411-
var client = coreapi.Client()
411+
var client = new coreapi.Client()
412412

413413
Typically you'll also want to provide some authentication credentials when
414414
instantiating the client.
@@ -423,7 +423,7 @@ the user to login, and then instantiate a client using session authentication:
423423
csrfCookieName: 'csrftoken',
424424
csrfHeaderName: 'X-CSRFToken'
425425
})
426-
let client = coreapi.Client({auth: auth})
426+
let client = new coreapi.Client({auth: auth})
427427

428428
The authentication scheme will handle including a CSRF header in any outgoing
429429
requests for unsafe HTTP methods.
@@ -437,7 +437,7 @@ The `TokenAuthentication` class can be used to support REST framework's built-in
437437
scheme: 'JWT'
438438
token: '<token>'
439439
})
440-
let client = coreapi.Client({auth: auth})
440+
let client = new coreapi.Client({auth: auth})
441441

442442
When using TokenAuthentication you'll probably need to implement a login flow
443443
using the CoreAPI client.
@@ -448,7 +448,7 @@ request to an "obtain token" endpoint
448448
For example, using the "Django REST framework JWT" package
449449

450450
// Setup some globally accessible state
451-
window.client = coreapi.Client()
451+
window.client = new coreapi.Client()
452452
window.loggedIn = false
453453

454454
function loginUser(username, password) {
@@ -475,7 +475,7 @@ The `BasicAuthentication` class can be used to support HTTP Basic Authentication
475475
username: '<username>',
476476
password: '<password>'
477477
})
478-
let client = coreapi.Client({auth: auth})
478+
let client = new coreapi.Client({auth: auth})
479479

480480
## Using the client
481481

0 commit comments

Comments
 (0)