Commit 5817c58d authored by Fernando's avatar Fernando

Fix Vuln details page request/response

* https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47966
* Fix bug due to field names changed to camelCase

Add bug fix change log

* Run prettier
parent e706ff7c
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
: ''; : '';
}, },
constructResponse(response) { constructResponse(response) {
const { body, status_code: statusCode, reason_phrase: reasonPhrase, headers = [] } = response; const { body, statusCode, reasonPhrase, headers = [] } = response;
const headerLines = this.getHeadersAsCodeBlockLines(headers); const headerLines = this.getHeadersAsCodeBlockLines(headers);
return statusCode && reasonPhrase && headerLines return statusCode && reasonPhrase && headerLines
......
---
title: Fix Vuln details page request/response sections not appearing
merge_request: 49166
author:
type: fixed
...@@ -241,29 +241,29 @@ describe('Vulnerability Details', () => { ...@@ -241,29 +241,29 @@ describe('Vulnerability Details', () => {
}); });
it.each` it.each`
response | expectedData response | expectedData
${null} | ${null} ${null} | ${null}
${{}} | ${null} ${{}} | ${null}
${{ headers: TEST_HEADERS }} | ${null} ${{ headers: TEST_HEADERS }} | ${null}
${{ headers: TEST_HEADERS, body: '[{"user_id":1,}]' }} | ${null} ${{ headers: TEST_HEADERS, body: '[{"user_id":1,}]' }} | ${null}
${{ headers: TEST_HEADERS, body: '[{"user_id":1,}]', status_code: '500' }} | ${null} ${{ headers: TEST_HEADERS, body: '[{"user_id":1,}]', statusCode: '500' }} | ${null}
${{ headers: TEST_HEADERS, body: '[{"user_id":1,}]', status_code: '500', reason_phrase: 'INTERNAL SERVER ERROR' }} | ${[EXPECT_RESPONSE]} ${{ headers: TEST_HEADERS, body: '[{"user_id":1,}]', statusCode: '500', reasonPhrase: 'INTERNAL SERVER ERROR' }} | ${[EXPECT_RESPONSE]}
`('shows response data for $response', ({ response, expectedData }) => { `('shows response data for $response', ({ response, expectedData }) => {
createWrapper({ response }); createWrapper({ response });
expect(getSectionData('response')).toEqual(expectedData); expect(getSectionData('response')).toEqual(expectedData);
}); });
it.each` it.each`
supportingMessages | expectedData supportingMessages | expectedData
${null} | ${null} ${null} | ${null}
${[]} | ${null} ${[]} | ${null}
${[{}]} | ${null} ${[{}]} | ${null}
${[{}, { response: {} }]} | ${null} ${[{}, { response: {} }]} | ${null}
${[{}, { response: { headers: TEST_HEADERS } }]} | ${null} ${[{}, { response: { headers: TEST_HEADERS } }]} | ${null}
${[{}, { response: { headers: TEST_HEADERS, body: '[{"user_id":1,}]' } }]} | ${null} ${[{}, { response: { headers: TEST_HEADERS, body: '[{"user_id":1,}]' } }]} | ${null}
${[{}, { response: { headers: TEST_HEADERS, body: '[{"user_id":1,}]', status_code: '200' } }]} | ${null} ${[{}, { response: { headers: TEST_HEADERS, body: '[{"user_id":1,}]', status_code: '200' } }]} | ${null}
${[{}, { response: { headers: TEST_HEADERS, body: '[{"user_id":1,}]', status_code: '200', reason_phrase: 'OK' } }]} | ${null} ${[{}, { response: { headers: TEST_HEADERS, body: '[{"user_id":1,}]', status_code: '200', reason_phrase: 'OK' } }]} | ${null}
${[{}, { name: SUPPORTING_MESSAGE_TYPES.RECORDED, response: { headers: TEST_HEADERS, body: '[{"user_id":1,}]', status_code: '200', reason_phrase: 'OK' } }]} | ${[EXPECT_RECORDED_RESPONSE]} ${[{}, { name: SUPPORTING_MESSAGE_TYPES.RECORDED, response: { headers: TEST_HEADERS, body: '[{"user_id":1,}]', statusCode: '200', reasonPhrase: 'OK' } }]} | ${[EXPECT_RECORDED_RESPONSE]}
`('shows response data for $supporting_messages', ({ supportingMessages, expectedData }) => { `('shows response data for $supporting_messages', ({ supportingMessages, expectedData }) => {
createWrapper({ supportingMessages }); createWrapper({ supportingMessages });
expect(getSectionData('recorded-response')).toEqual(expectedData); expect(getSectionData('recorded-response')).toEqual(expectedData);
......
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