SchemaJSRenderer renders invalid Javascript · Issue #5608 · encode/django-rest-framework (original) (raw)
Steps to reproduce
Request docs/schema.js when using a Python 3 server.
Expected behavior
Get valid Javascript looking like:
var coreJSON = window.atob('eyJf...');
Actual behavior
Under Py3 the base64.b64encode() method returns a binary object, which gets rendered as b'...' in schema.js. This results in the output becoming:
var coreJSON = window.atob('b'eyJf...'');
which is invalid Javascript.