Skip to content

Commit 048c6d0

Browse files
author
Emmanouil Konstantinidis
committed
Check if methods are array or not
1 parent de4157e commit 048c6d0

File tree

2 files changed

+1568
-15
lines changed

2 files changed

+1568
-15
lines changed

rest_framework_docs/static/rest_framework_docs/js/components/request.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var _ = require('underscore');
12
var React = require('react');
23

34
var FieldsData = require('./request/fields-data');
@@ -17,7 +18,8 @@ var Request = React.createClass({
1718

1819
componentWillMount: function() {
1920
var endpoint = this.props.endpoint;
20-
endpoint['methods'] = this.transformMethods(endpoint.methods);
21+
endpoint['methods'] = _.isArray(endpoint.methods) ?
22+
endpoint.methods : this.transformMethods(endpoint.methods);
2123

2224
this.setState({
2325
endpoint: endpoint,
@@ -88,7 +90,7 @@ var Request = React.createClass({
8890

8991
{RequestUtils.shouldAddData(this.state.method) ? null : (
9092
<div>
91-
<Header title='Data' />
93+
{this.state.endpoint.fields.length ? <Header title='Data' /> : null}
9294
<FieldsData
9395
fields={endpoint.fields}
9496
data={this.state.data}

0 commit comments

Comments
 (0)