Skip to content

Commit 692dc54

Browse files
committed
More liberal detection of DID resolution/derefencing result from driver
1 parent 9aedc41 commit 692dc54

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

driver-http/src/main/java/uniresolver/driver/http/HttpDriver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public ResolveResult resolve(DID did, Map<String, Object> resolutionOptions) thr
173173
}
174174

175175
if (httpStatusCode != 200 && resolveResult == null) {
176-
throw new ResolutionException(ResolutionException.ERROR_INTERNAL_ERROR, "Driver cannot retrieve result for " + did + ": " + httpStatusCode + " " + httpStatusMessage + " (" + httpBodyString + ")");
176+
throw new ResolutionException(ResolutionException.ERROR_INTERNAL_ERROR, "Driver cannot retrieve RESOLVE result for " + did + ": " + httpStatusCode + " " + httpStatusMessage + " (" + httpBodyString + ")");
177177
}
178178

179179
if (resolveResult != null && resolveResult.isErrorResult()) {
@@ -308,7 +308,7 @@ public DereferenceResult dereference(DIDURL didUrl, Map<String, Object> derefere
308308
}
309309

310310
if (httpStatusCode != 200 && dereferenceResult == null) {
311-
throw new DereferencingException(DereferencingException.ERROR_INTERNAL_ERROR, "Driver cannot retrieve result for " + didUrl + ": " + httpStatusCode + " " + httpStatusMessage + " (" + httpBodyString + ")");
311+
throw new DereferencingException(DereferencingException.ERROR_INTERNAL_ERROR, "Driver cannot retrieve DEREFERENCE result for " + didUrl + ": " + httpStatusCode + " " + httpStatusMessage + " (" + httpBodyString + ")");
312312
}
313313

314314
if (dereferenceResult != null && dereferenceResult.isErrorResult()) {

uni-resolver-core/src/main/java/uniresolver/util/HttpBindingClientUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public static boolean isResolveResultHttpContent(String httpContentString) {
297297
boolean isResolveResultHttpContent;
298298
try {
299299
Map<String, Object> json = objectMapper.readValue(httpContentString, Map.class);
300-
isResolveResultHttpContent = json.containsKey("didDocument") || json.containsKey("didDocumentStream");
300+
isResolveResultHttpContent = json.containsKey("didResolutionMetadata") || json.containsKey("didDocumentMetadata") || json.containsKey("didDocument") || json.containsKey("didDocumentStream");
301301
} catch (JsonProcessingException ex) {
302302
isResolveResultHttpContent = false;
303303
}
@@ -309,7 +309,7 @@ public static boolean isDereferenceResultHttpContent(String httpContentString) {
309309
boolean isDereferenceResultHttpContent;
310310
try {
311311
Map<String, Object> json = objectMapper.readValue(httpContentString, Map.class);
312-
isDereferenceResultHttpContent = json.containsKey("content") || json.containsKey("contentStream");
312+
isDereferenceResultHttpContent = json.containsKey("dereferencingMetadata") || json.containsKey("contentMetadata") || json.containsKey("content") || json.containsKey("contentStream");
313313
} catch (JsonProcessingException ex) {
314314
isDereferenceResultHttpContent = false;
315315
}

0 commit comments

Comments
 (0)