Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,19 @@ export const KeyValueEditor: FC<Props> = ({
// smelly
const pairsWithIds = pairs.map(pair => ({ ...pair, id: pair.id || generateId('pair') }));

const readOnlyPairs = [
const readOnlyWebsocketPairs = [
{ name: 'Connection', value: 'Upgrade' },
{ name: 'Upgrade', value: 'websocket' },
{ name: 'Sec-WebSocket-Key', value: '<calculated at runtime>' },
{ name: 'Sec-WebSocket-Version', value: '13' },
{ name: 'Sec-WebSocket-Extensions', value: 'permessage-deflate; client_max_window_bits' },
].map(pair => ({ ...pair, id: generateId('pair') }));

const readOnlyHttpPairs = [
{ name: 'Accept', value: '*/*' },
{ name: 'Host', value: '<calculated at runtime>' },
].map(pair => ({ ...pair, id: generateId('pair') }));
const readOnlyPairs = isWebSocketRequest ? readOnlyWebsocketPairs : readOnlyHttpPairs;
const [showDescription, setShowDescription] = React.useState(false);

return (
Expand Down Expand Up @@ -124,7 +129,7 @@ export const KeyValueEditor: FC<Props> = ({
addPair={() => { }}
/>
)}
{isWebSocketRequest ? readOnlyPairs.map(pair => (
{readOnlyPairs.map(pair => (
<li key={pair.id} className="key-value-editor__row-wrapper">
<div className="key-value-editor__row">
<div className="form-control form-control--underlined form-control--wide">
Expand All @@ -145,7 +150,7 @@ export const KeyValueEditor: FC<Props> = ({
<button><i className="fa fa-empty" /></button>
</div>
</li>
)) : null}
))}
{pairsWithIds.map(pair => (
<Row
key={pair.id}
Expand Down