Skip to content

Commit a721630

Browse files
author
Emmanouil Konstantinidis
committed
Attach headers to request
1 parent c5202c2 commit a721630

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

rest_framework_docs/static/rest_framework_docs/js/components/liveapi.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,17 @@ var LiveAPIEndpoints = React.createClass({
2626

2727
var self = this;
2828
var request = this.refs.request.state;
29+
30+
var headers = {};
31+
if (this.refs.request.state.headers.authorization) {
32+
headers['Authorization'] = this.refs.request.state.headers.authorization;
33+
};
34+
2935
var data = this.getData();
3036

3137
// Now Make the Request
3238
APIRequest(request.selectedMethod, request.endpoint.path)
39+
.set(headers)
3340
.send(data)
3441
.end(function (err, res) {
3542
self.setState({

rest_framework_docs/static/rest_framework_docs/js/dist.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32402,10 +32402,16 @@ var LiveAPIEndpoints = React.createClass({
3240232402

3240332403
var self = this;
3240432404
var request = this.refs.request.state;
32405+
32406+
var headers = {};
32407+
if (this.refs.request.state.headers.authorization) {
32408+
headers['Authorization'] = this.refs.request.state.headers.authorization;
32409+
};
32410+
3240532411
var data = this.getData();
3240632412

3240732413
// Now Make the Request
32408-
APIRequest(request.selectedMethod, request.endpoint.path).send(data).end(function (err, res) {
32414+
APIRequest(request.selectedMethod, request.endpoint.path).set(headers).send(data).end(function (err, res) {
3240932415
self.setState({
3241032416
response: res
3241132417
});

0 commit comments

Comments
 (0)