import React, {PropTypes} from 'react'; import {Cookie} from 'tough-cookie'; const ResponseCookiesViewer = ({headers, showCookiesModal}) => { if (!headers.length) { // Don't do anything if no cookies return ( No cookies returned ); } return (
{headers.map((h, i) => { const cookie = Cookie.parse(h.value); return ( ); })}
Name Value
{cookie ? cookie.key : 'n/a'} {cookie ? cookie.value : 'malformed set-cookie header'}

) }; ResponseCookiesViewer.propTypes = { showCookiesModal: PropTypes.func.isRequired, headers: PropTypes.array.isRequired }; export default ResponseCookiesViewer;