Skip to content

Commit 4f09dd8

Browse files
committed
WIP checking headers
1 parent 41e0b17 commit 4f09dd8

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

serverless/lib/NameSearchProcessor.ts

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -392,38 +392,18 @@ export async function fetchCasesByName(
392392
};
393393
}
394394

395-
// Extract SmartSearchCriteria cookie from response headers
396-
const setCookieHeader = searchResponse.headers['set-cookie'];
397-
let smartSearchCriteriaCookie = '';
398-
399-
if (setCookieHeader) {
400-
if (Array.isArray(setCookieHeader)) {
401-
// Find the SmartSearchCriteria cookie if it's in an array of cookies
402-
const smartSearchCookie = setCookieHeader.find(cookie =>
403-
cookie.startsWith('SmartSearchCriteria='));
404-
if (smartSearchCookie) {
405-
smartSearchCriteriaCookie = smartSearchCookie.split(';')[0];
406-
console.log(`Found SmartSearchCriteria cookie: ${smartSearchCriteriaCookie}`);
407-
}
408-
}
409-
}
395+
// Check if cookies were actually added to the jar
396+
const cookies = cookieJar.getCookiesSync(`${portalUrl}/Portal`);
397+
console.log(`Cookie jar after SmartSearch request contains ${cookies.length} cookies:`);
398+
cookies.forEach(cookie => {
399+
console.log(`- ${cookie.key}=${cookie.value} (domain=${cookie.domain}, path=${cookie.path})`);
400+
});
410401

411402
// Step 2: Get the search results page
412403
console.log("Getting smart search results");
413404

414-
let requestOptions = {};
415-
if (smartSearchCriteriaCookie) {
416-
requestOptions = {
417-
headers: {
418-
'Cookie': smartSearchCriteriaCookie
419-
}
420-
};
421-
console.log('Adding SmartSearchCriteria cookie to request');
422-
}
423-
424405
const resultsResponse = await client.get(
425406
`${portalUrl}/Portal/SmartSearch/SmartSearchResults`,
426-
requestOptions
427407
);
428408

429409
if (resultsResponse.status !== 200) {

0 commit comments

Comments
 (0)