mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
7f86b46417
* Added error boundaries for better failing * Fix regex escaping (fixes #525) * Many more error boundaries
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
import React, {PureComponent} from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import CopyButton from '../base/copy-button';
|
|
|
|
class ResponseHeadersViewer extends PureComponent {
|
|
render () {
|
|
const {headers} = this.props;
|
|
|
|
const headersString = headers.map(
|
|
h => `${h.name}: ${h.value}`
|
|
).join('\n');
|
|
|
|
return [
|
|
<table key='table' className="table--fancy table--striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Value</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{headers.map((h, i) => (
|
|
<tr className="selectable" key={i}>
|
|
<td style={{width: '50%'}} className="force-wrap">{h.name}</td>
|
|
<td style={{width: '50%'}} className="force-wrap">{h.value}</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>,
|
|
<p key='copy' className="pad-top">
|
|
<CopyButton
|
|
className="pull-right btn btn--clicky"
|
|
content={headersString}
|
|
/>
|
|
</p>
|
|
];
|
|
}
|
|
}
|
|
|
|
ResponseHeadersViewer.propTypes = {
|
|
headers: PropTypes.array.isRequired
|
|
};
|
|
|
|
export default ResponseHeadersViewer;
|