Skip to content

Commit 3ee4f8d

Browse files
authored
Merge branch 'master' into base-url
2 parents 13eed0d + 213f6d7 commit 3ee4f8d

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/core/components/headers.jsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@ import React from "react"
22
import PropTypes from "prop-types"
33
import Im from "immutable"
44

5+
const propStyle = { color: "#999", fontStyle: "italic" }
6+
57
export default class Headers extends React.Component {
68

79
static propTypes = {
8-
headers: PropTypes.object.isRequired
10+
headers: PropTypes.object.isRequired,
11+
getComponent: PropTypes.func.isRequired
912
};
1013

1114
render() {
1215

13-
let { headers } = this.props
16+
let { headers, getComponent } = this.props
17+
const Property = getComponent("Property")
1418

1519
if ( !headers || !headers.size )
1620
return null
1721

18-
return (
22+
return (
1923
<div className="headers-wrapper">
2024
<h4 className="headers__title">Headers:</h4>
2125
<table className="headers">
@@ -32,10 +36,13 @@ export default class Headers extends React.Component {
3236
if(!Im.Map.isMap(header)) {
3337
return null
3438
}
39+
const type = header.getIn(["schema"]) ? header.getIn(["schema", "type"]) : header.getIn(["type"])
40+
const schemaExample = header.getIn(["schema", "example"])
41+
3542
return (<tr key={ key }>
3643
<td className="header-col">{ key }</td>
3744
<td className="header-col">{ header.get( "description" ) }</td>
38-
<td className="header-col">{ header.get( "type" ) }</td>
45+
<td className="header-col">{ type } { schemaExample ? <Property propKey={ "Example" } propVal={ schemaExample } propStyle={ propStyle } /> : null }</td>
3946
</tr>)
4047
}).toArray()
4148
}

src/core/components/response.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ export default class Response extends React.Component {
153153
) : null}
154154

155155
{ headers ? (
156-
<Headers headers={ headers }/>
156+
<Headers
157+
headers={ headers }
158+
getComponent={ getComponent }
159+
/>
157160
) : null}
158161

159162

0 commit comments

Comments
 (0)