Commit 0113b00d authored by Alexander Turinske's avatar Alexander Turinske Committed by Paul Slaughter

Fix vuln details page not loading

- it was expecting the request and response parameters
  to not exist, but the backend changed them so that
  they were null
- update tests
parent 3f25ac70
......@@ -54,7 +54,11 @@ export default {
};
},
requestData() {
const { request: { method, url, headers = [] } = {} } = this.vulnerability;
if (!this.vulnerability.request) {
return [];
}
const { method, url, headers = [] } = this.vulnerability.request;
return [
{
......@@ -73,9 +77,15 @@ export default {
].filter(x => x.content);
},
responseData() {
if (!this.vulnerability.response) {
return [];
}
const {
response: { status_code: statusCode, reason_phrase: reasonPhrase, headers = [] } = {},
} = this.vulnerability;
status_code: statusCode,
reason_phrase: reasonPhrase,
headers = [],
} = this.vulnerability.response;
return [
{
......
......@@ -199,6 +199,7 @@ describe('Vulnerability Details', () => {
it.each`
request | expectedData
${null} | ${null}
${{}} | ${null}
${{ headers: TEST_HEADERS }} | ${[EXPECT_HEADERS]}
${{ headers: TEST_HEADERS, method: 'GET' }} | ${[{ label: 'Method:', content: 'GET' }, EXPECT_HEADERS]}
......@@ -212,6 +213,7 @@ describe('Vulnerability Details', () => {
it.each`
response | expectedData
${null} | ${null}
${{}} | ${null}
${{ headers: TEST_HEADERS }} | ${[EXPECT_HEADERS]}
${{ headers: TEST_HEADERS, status_code: 200 }} | ${[EXPECT_HEADERS]}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment