Allow responses with no "type" field to succeed for ServiceExtensionConsumers.

Change-Id: If7f239c67e54330e77e805dd2375bbfba1dbd76c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117441
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Kenzie Schmoll <kenzieschmoll@google.com>
This commit is contained in:
Kenzie Schmoll 2019-09-17 14:42:31 +00:00 committed by commit-bot@chromium.org
parent e00c8f3cb7
commit 9753a397bf

View file

@ -618,11 +618,13 @@ abstract class VmServiceBase implements VmServiceConst {
Logging.getLogger().logError("Response has invalid " + RESULT, e);
return;
}
String responseType;
try {
String responseType = "";
if (result.has(TYPE)) {
responseType = result.get(TYPE).getAsString();
} catch (Exception e) {
Logging.getLogger().logError("Response missing " + TYPE, e);
}
// ServiceExtensionConsumers do not care about the response type.
else if (!(consumer instanceof ServiceExtensionConsumer)) {
Logging.getLogger().logError("Response missing " + TYPE + ": " + result.toString());
return;
}
forwardResponse(consumer, responseType, result);