Skip to content

Commit

Permalink
fix(frontend): fix test spec expression for header field (#2710)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeepc committed Jun 12, 2023
1 parent c868df6 commit 7b98216
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions web/src/components/HeaderRow/HeaderRow.tsx
Expand Up @@ -6,12 +6,11 @@ import * as S from './HeaderRow.styled';

interface IProps {
header: THeader;
index: number;
onCreateTestOutput(attribute: TSpanFlatAttribute): void;
onCreateTestSpec(attribute: TSpanFlatAttribute): void;
}

const HeaderRow = ({header: {key = '', value = ''}, index, onCreateTestOutput, onCreateTestSpec}: IProps) => {
const HeaderRow = ({header: {key = '', value = ''}, onCreateTestOutput, onCreateTestSpec}: IProps) => {
return (
<S.HeaderContainer>
<S.Header>
Expand All @@ -21,7 +20,7 @@ const HeaderRow = ({header: {key = '', value = ''}, index, onCreateTestOutput, o
</S.HeaderValue>
</S.Header>
<AttributeActions
attribute={{key: `tracetest.response.headers | json_path '$[${index}].Value'`, value}}
attribute={{key: `tracetest.response.headers | json_path '$[?(@.Key=="${key}")].Value'`, value}}
onCreateTestOutput={onCreateTestOutput}
onCreateTestSpec={onCreateTestSpec}
/>
Expand Down
Expand Up @@ -17,10 +17,9 @@ const ResponseHeaders = ({headers, state, onCreateTestOutput, onCreateTestSpec}:
isRunStateFinished(state) || !!headers ? (
<S.HeadersList>
{headers &&
headers.map((header, index) => (
headers.map(header => (
<HeaderRow
header={header}
index={index}
key={header.key}
onCreateTestOutput={onCreateTestOutput}
onCreateTestSpec={onCreateTestSpec}
Expand Down

0 comments on commit 7b98216

Please sign in to comment.