Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
57cd0f14
Commit
57cd0f14
authored
May 14, 2014
by
Matt Drayer
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mattdrayer/api-csrftoken: Include CSRF token in the response payload
parent
ee2aa4ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
0 deletions
+3
-0
lms/djangoapps/api_manager/system/tests.py
+1
-0
lms/djangoapps/api_manager/system/views.py
+2
-0
No files found.
lms/djangoapps/api_manager/system/tests.py
View file @
57cd0f14
...
...
@@ -69,6 +69,7 @@ class SystemApiTests(TestCase):
self
.
assertIsNotNone
(
response
.
data
[
'uri'
])
self
.
assertGreater
(
len
(
response
.
data
[
'uri'
]),
0
)
self
.
assertEqual
(
response
.
data
[
'uri'
],
test_uri
)
self
.
assertGreater
(
len
(
response
.
data
[
'csrf_token'
]),
0
)
self
.
assertIsNotNone
(
response
.
data
[
'documentation'
])
self
.
assertGreater
(
len
(
response
.
data
[
'documentation'
]),
0
)
self
.
assertIsNotNone
(
response
.
data
[
'name'
])
...
...
lms/djangoapps/api_manager/system/views.py
View file @
57cd0f14
""" BASE API VIEWS """
from
django.middleware.csrf
import
get_token
from
rest_framework
import
status
from
rest_framework.response
import
Response
...
...
@@ -47,6 +48,7 @@ class ApiDetail(APIView):
response_data
[
'description'
]
=
"Machine interface for interactions with Open edX."
response_data
[
'documentation'
]
=
"http://docs.openedxapi.apiary.io"
response_data
[
'uri'
]
=
base_uri
response_data
[
'csrf_token'
]
=
get_token
(
request
)
response_data
[
'resources'
]
=
[]
response_data
[
'resources'
]
.
append
({
'uri'
:
base_uri
+
'courses'
})
response_data
[
'resources'
]
.
append
({
'uri'
:
base_uri
+
'groups'
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment