Skip to content

Commit

Permalink
STNG-157 API-Version header check now supporting empty header list
Browse files Browse the repository at this point in the history
  • Loading branch information
gj0dcsa committed Aug 31, 2024
1 parent 3005a0b commit 1024766
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ protected Set<String> checkConformance(Function<UUID, ConformanceExchange> getEx
.findFirst()
.orElse("api-version");
Collection<String> headerValues = headers.get(headerName);
if (headerValues.size() != 1) return Set.of("Duplicate Api-Version headers");
if (headerValues == null || headerValues.isEmpty()) {
return httpMessageType.equals(HttpMessageType.RESPONSE) && !isNotification
? Set.of("Missing Api-Version header")
: Collections.emptySet();
}
if (headerValues.size() > 1) return Set.of("Duplicate Api-Version headers");
String exchangeApiVersion = headerValues.stream().findFirst().orElseThrow();
if (exchangeApiVersion.contains("-")) {
exchangeApiVersion = exchangeApiVersion.substring(0, exchangeApiVersion.indexOf("-"));
Expand Down
2 changes: 1 addition & 1 deletion spring-boot/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
conformance.createAutoTestingSandboxes = true
conformance.createManualTestingSandboxes = false
conformance.createManualTestingSandboxes = true
conformance.useDynamoDb = false
conformance.showOnlyAllInOneSandboxes=true
#conformance.simulatedLambdaDelay=2000

0 comments on commit 1024766

Please sign in to comment.