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 { ...@@ -54,7 +54,11 @@ export default {
}; };
}, },
requestData() { requestData() {
const { request: { method, url, headers = [] } = {} } = this.vulnerability; if (!this.vulnerability.request) {
return [];
}
const { method, url, headers = [] } = this.vulnerability.request;
return [ return [
{ {
...@@ -73,9 +77,15 @@ export default { ...@@ -73,9 +77,15 @@ export default {
].filter(x => x.content); ].filter(x => x.content);
}, },
responseData() { responseData() {
if (!this.vulnerability.response) {
return [];
}
const { const {
response: { status_code: statusCode, reason_phrase: reasonPhrase, headers = [] } = {}, status_code: statusCode,
} = this.vulnerability; reason_phrase: reasonPhrase,
headers = [],
} = this.vulnerability.response;
return [ return [
{ {
......
...@@ -199,6 +199,7 @@ describe('Vulnerability Details', () => { ...@@ -199,6 +199,7 @@ describe('Vulnerability Details', () => {
it.each` it.each`
request | expectedData request | expectedData
${null} | ${null}
${{}} | ${null} ${{}} | ${null}
${{ headers: TEST_HEADERS }} | ${[EXPECT_HEADERS]} ${{ headers: TEST_HEADERS }} | ${[EXPECT_HEADERS]}
${{ headers: TEST_HEADERS, method: 'GET' }} | ${[{ label: 'Method:', content: 'GET' }, EXPECT_HEADERS]} ${{ headers: TEST_HEADERS, method: 'GET' }} | ${[{ label: 'Method:', content: 'GET' }, EXPECT_HEADERS]}
...@@ -212,6 +213,7 @@ describe('Vulnerability Details', () => { ...@@ -212,6 +213,7 @@ describe('Vulnerability Details', () => {
it.each` it.each`
response | expectedData response | expectedData
${null} | ${null}
${{}} | ${null} ${{}} | ${null}
${{ headers: TEST_HEADERS }} | ${[EXPECT_HEADERS]} ${{ headers: TEST_HEADERS }} | ${[EXPECT_HEADERS]}
${{ headers: TEST_HEADERS, status_code: 200 }} | ${[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