getWellknown method

Future<DiscoveryInformation> getWellknown()
inherited

Gets discovery information about the domain. The file may include additional keys, which MUST follow the Java package naming convention, e.g. com.example.myapp.property. This ensures property names are suitably namespaced for each application and reduces the risk of clashes.

Note that this endpoint is not necessarily handled by the node, but by another webserver, to be used for discovering the node URL.

Implementation

Future<DiscoveryInformation> getWellknown() async {
  final requestUri = Uri(path: '.well-known/sdn/client');
  final request = Request('GET', baseUri!.resolveUri(requestUri));
  final response = await httpClient.send(request);
  final responseBody = await response.stream.toBytes();
  if (response.statusCode != 200) unexpectedResponse(response, responseBody);
  final responseString = utf8.decode(responseBody);
  print("getWellknown responseString:$responseString");
  final json = jsonDecode(responseString);
  return DiscoveryInformation.fromJson(json as Map<String, Object?>);
}