Merge branch 'master' into fix-model-markdown
This commit is contained in:
@@ -22,13 +22,14 @@ export default class LiveResponse extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const { request, response, getComponent } = this.props
|
const { request, response, getComponent } = this.props
|
||||||
|
|
||||||
const body = response.get("text")
|
|
||||||
const status = response.get("status")
|
const status = response.get("status")
|
||||||
const url = response.get("url")
|
const url = response.get("url")
|
||||||
const headers = response.get("headers").toJS()
|
const headers = response.get("headers").toJS()
|
||||||
const notDocumented = response.get("notDocumented")
|
const notDocumented = response.get("notDocumented")
|
||||||
const isError = response.get("error")
|
const isError = response.get("error")
|
||||||
|
|
||||||
|
const body = isError ? response.get("response").get("text") : response.get("text")
|
||||||
|
|
||||||
const headersKeys = Object.keys(headers)
|
const headersKeys = Object.keys(headers)
|
||||||
const contentType = headers["content-type"]
|
const contentType = headers["content-type"]
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ export default class LiveResponse extends React.Component {
|
|||||||
const returnObject = headersKeys.map(key => {
|
const returnObject = headersKeys.map(key => {
|
||||||
return <span className="headerline" key={key}> {key}: {headers[key]} </span>
|
return <span className="headerline" key={key}> {key}: {headers[key]} </span>
|
||||||
})
|
})
|
||||||
|
const hasHeaders = returnObject.length !== 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -54,28 +56,29 @@ export default class LiveResponse extends React.Component {
|
|||||||
<td className="col response-col_status">
|
<td className="col response-col_status">
|
||||||
{ status }
|
{ status }
|
||||||
{
|
{
|
||||||
!notDocumented ? null :
|
notDocumented ? <div className="response-undocumented">
|
||||||
<div className="response-undocumented">
|
<i> Undocumented </i>
|
||||||
<i> Undocumented </i>
|
</div>
|
||||||
</div>
|
: null
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td className="col response-col_description">
|
<td className="col response-col_description">
|
||||||
{
|
{
|
||||||
!isError ? null : <span>
|
isError ? <span>
|
||||||
{`${response.get("name")}: ${response.get("message")}`}
|
{`${response.get("name")}: ${response.get("message")}`}
|
||||||
</span>
|
</span>
|
||||||
|
: null
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
!body || isError ? null
|
body ? <ResponseBody content={ body }
|
||||||
: <ResponseBody content={ body }
|
contentType={ contentType }
|
||||||
contentType={ contentType }
|
url={ url }
|
||||||
url={ url }
|
headers={ headers }
|
||||||
headers={ headers }
|
getComponent={ getComponent }/>
|
||||||
getComponent={ getComponent }/>
|
: null
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
!headers ? null : <Headers headers={ returnObject }/>
|
hasHeaders ? <Headers headers={ returnObject }/> : null
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user