Skip to content

Commit 00a059b

Browse files
author
daniel-smartbear
committed
fix response header type not showing, and displaying example below if theres one present
1 parent 5015348 commit 00a059b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/core/components/headers.jsx

Lines changed: 8 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">
@@ -35,7 +39,7 @@ export default class Headers extends React.Component {
3539
return (<tr key={ key }>
3640
<td className="header-col">{ key }</td>
3741
<td className="header-col">{ header.get( "description" ) }</td>
38-
<td className="header-col">{ header.get( "type" ) }</td>
42+
<td className="header-col">{ header.get( "schema" ).get( "type" ) } { header.get( "schema" ).get( "example" ) ? <Property propKey={ "Example" } propVal={ header.get( "schema" ).get( "example" ) } propStyle={ propStyle } /> : null }</td>
3943
</tr>)
4044
}).toArray()
4145
}

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)