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 {
};
},
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