From 2952fe68071dd53edf4d13d90ff4c27d3d584c81 Mon Sep 17 00:00:00 2001 From: Xavi Aracil Date: Tue, 7 Feb 2023 19:11:47 +0100 Subject: [PATCH] Set accept header for revocation list --- .../org/oneedtech/inspect/vc/probe/RevocationListProbe.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/RevocationListProbe.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/RevocationListProbe.java index e083c42..7d2ae55 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/RevocationListProbe.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/RevocationListProbe.java @@ -3,6 +3,7 @@ package org.oneedtech.inspect.vc.probe; import static org.oneedtech.inspect.core.probe.RunContext.Key.JACKSON_OBJECTMAPPER; import java.io.InputStream; +import java.net.HttpURLConnection; import java.net.URI; import java.net.URL; import java.util.List; @@ -10,6 +11,7 @@ import java.util.List; import org.oneedtech.inspect.core.probe.Probe; import org.oneedtech.inspect.core.probe.RunContext; import org.oneedtech.inspect.core.report.ReportItems; +import org.oneedtech.inspect.util.resource.MimeType; import org.oneedtech.inspect.vc.Credential; import org.oneedtech.inspect.vc.VerifiableCredential; import org.oneedtech.inspect.vc.util.JsonNodeUtil; @@ -45,7 +47,9 @@ public class RevocationListProbe extends Probe { if(listID != null) { try { URL url = new URI(listID.asText().strip()).toURL(); - try (InputStream is = url.openStream()) { + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestProperty("Accept", MimeType.JSON.toString()); + try (InputStream is = connection.getInputStream()) { JsonNode revocList = ((ObjectMapper)ctx.get(JACKSON_OBJECTMAPPER)).readTree(is.readAllBytes()); /* To check if a credential has been revoked, the verifier issues a GET request