@@ -1377,22 +1377,29 @@ abstract class AbstractRestFitness : HttpWsFitness<RestIndividual>() {
13771377 if (a.verb != HttpVerb .OPTIONS ) continue
13781378
13791379 val r = actionResults.find { it.sourceLocalId == a.getLocalId() } as RestCallResult ? ? : continue
1380+ // The Allow header is not mandatory in an OPTIONS response
1381+ // (see https://httpwg.org/specs/rfc9110.html#OPTIONS), so if it is
1382+ // missing we cannot conclude anything, ie it is not a fault.
13801383 val allowed = r.getAllowedVerbs() ? : continue
13811384
13821385 // listed in Allow but not declared in the schema
1383- val extra = allowed.any {
1386+ val extra = allowed.filter {
13841387 it != HttpVerb .OPTIONS && it != HttpVerb .HEAD && ! callGraphService.isDeclared(it, a.path)
1385- }
1388+ }.sorted()
13861389 // declared in the schema but not listed in Allow
1387- val missing = HttpVerb .values().any {
1390+ val missing = HttpVerb .values().filter {
13881391 it != HttpVerb .OPTIONS && it != HttpVerb .HEAD && callGraphService.isDeclared(it, a.path) && it !in allowed
13891392 }
1390- if (! extra && ! missing) continue
1393+ if (extra.isEmpty() && missing.isEmpty() ) continue
13911394
13921395 val category = ExperimentalFaultCategory .HTTP_INVALID_ALLOW
13931396 val scenarioId = idMapper.handleLocalTarget(idMapper.getFaultDescriptiveId(category, a.getName()))
13941397 fv.updateTarget(scenarioId, 1.0 , index)
1395- r.addFault(DetectedFault (category, a.getName(), null ))
1398+ val localMessage = listOfNotNull(
1399+ extra.takeIf { it.isNotEmpty() }?.let { " extra verbs: $it " },
1400+ missing.takeIf { it.isNotEmpty() }?.let { " missing verbs: $it " }
1401+ ).joinToString(" ; " )
1402+ r.addFault(DetectedFault (category, a.getName(), null , localMessage))
13961403 }
13971404 }
13981405
0 commit comments