Skip to content

Commit 0db81a4

Browse files
fix: Accept HTTP 208 (Already Reported) as valid success status for search/browse tests
1 parent b68655a commit 0db81a4

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

test.html

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -286,16 +286,18 @@ <h3>Tests Passed: ${passed}/${total} (${percentage}%)</h3>
286286

287287
try {
288288
const response = await fetch('https://www.datasetiq.com/api/public/search?q=GDP');
289-
if (!response.ok) {
289+
const status = response.status;
290+
291+
if (status !== 200 && status !== 208) {
290292
resultDiv.className = 'result error';
291-
resultDiv.textContent = `❌ HTTP ${response.status}: ${response.statusText}\nURL: ${response.url}`;
293+
resultDiv.textContent = `❌ HTTP ${status}: ${response.statusText}\nURL: ${response.url}`;
292294
testResults['search'] = false;
293295
updateOverallStatus();
294296
return;
295297
}
296298
const data = await response.json();
297299

298-
testResults['search'] = response.status === 200 && Array.isArray(data);
300+
testResults['search'] = (status === 200 || status === 208) && Array.isArray(data);
299301

300302
if (testResults['search']) {
301303
resultDiv.className = 'result success';
@@ -319,16 +321,18 @@ <h3>Tests Passed: ${passed}/${total} (${percentage}%)</h3>
319321

320322
try {
321323
const response = await fetch('https://www.datasetiq.com/api/public/search?q=GDP&source=FRED');
322-
if (!response.ok) {
324+
const status = response.status;
325+
326+
if (status !== 200 && status !== 208) {
323327
resultDiv.className = 'result error';
324-
resultDiv.textContent = `❌ HTTP ${response.status}: ${response.statusText}`;
328+
resultDiv.textContent = `❌ HTTP ${status}: ${response.statusText}`;
325329
testResults['search-source'] = false;
326330
updateOverallStatus();
327331
return;
328332
}
329333
const data = await response.json();
330334

331-
testResults['search-source'] = response.status === 200 && Array.isArray(data);
335+
testResults['search-source'] = (status === 200 || status === 208) && Array.isArray(data);
332336

333337
if (testResults['search-source']) {
334338
resultDiv.className = 'result success';
@@ -352,16 +356,18 @@ <h3>Tests Passed: ${passed}/${total} (${percentage}%)</h3>
352356

353357
try {
354358
const response = await fetch(`https://www.datasetiq.com/api/public/search?source=${source}&limit=50`);
355-
if (!response.ok) {
359+
const status = response.status;
360+
361+
if (status !== 200 && status !== 208) {
356362
resultDiv.className = 'result error';
357-
resultDiv.textContent = `❌ HTTP ${response.status}: ${response.statusText}\nURL: ${response.url}`;
363+
resultDiv.textContent = `❌ HTTP ${status}: ${response.statusText}\nURL: ${response.url}`;
358364
testResults[`browse-${source}`] = false;
359365
updateOverallStatus();
360366
return;
361367
}
362368
const data = await response.json();
363369

364-
testResults[`browse-${source}`] = response.status === 200 && Array.isArray(data);
370+
testResults[`browse-${source}`] = (status === 200 || status === 208) && Array.isArray(data);
365371

366372
if (testResults[`browse-${source}`]) {
367373
resultDiv.className = 'result success';

0 commit comments

Comments
 (0)