Commit 009b3788 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch '273158-fix-null-value-handler-for-vuln-details' into 'master'

Fix vulnerability details page not loading

See merge request gitlab-org/gitlab!46245
parents 1611b9e4 0113b00d
...@@ -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