mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Preserve HAR entry comment during import (#1198)
This will fix an HAR export/import issue where names are lost. Fixes #1153
This commit is contained in:
parent
6f7a6d820b
commit
d3c002410b
@ -22,16 +22,11 @@ module.exports.convert = function(rawData) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function importRequest(request) {
|
function importRequest(request) {
|
||||||
const cookieHeaderValue = mapImporter(
|
const cookieHeaderValue = mapImporter(request.cookies, importCookieToHeaderString).join('; ');
|
||||||
request.cookies,
|
|
||||||
importCookieToHeaderString
|
|
||||||
).join('; ');
|
|
||||||
const headers = mapImporter(request.headers, importHeader);
|
const headers = mapImporter(request.headers, importHeader);
|
||||||
|
|
||||||
// Convert cookie value to header
|
// Convert cookie value to header
|
||||||
const existingCookieHeader = headers.find(
|
const existingCookieHeader = headers.find(h => h.name.toLowerCase() === 'cookie');
|
||||||
h => h.name.toLowerCase() === 'cookie'
|
|
||||||
);
|
|
||||||
if (cookieHeaderValue && existingCookieHeader) {
|
if (cookieHeaderValue && existingCookieHeader) {
|
||||||
// Has existing cookie header, so let's update it
|
// Has existing cookie header, so let's update it
|
||||||
existingCookieHeader.value += `; ${cookieHeaderValue}`;
|
existingCookieHeader.value += `; ${cookieHeaderValue}`;
|
||||||
@ -132,6 +127,11 @@ function extractRequests(harRoot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const entry of log.entries) {
|
for (const entry of log.entries) {
|
||||||
|
if (entry.comment && entry.request && !entry.request.comment) {
|
||||||
|
// Preserve the entry comment for request name generation
|
||||||
|
entry.request.comment = entry.comment;
|
||||||
|
}
|
||||||
|
|
||||||
requests.push(entry.request);
|
requests.push(entry.request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user