diff --git a/lib/src/binding_coap/coap_client.dart b/lib/src/binding_coap/coap_client.dart index 0bf5a828..b9b7d818 100644 --- a/lib/src/binding_coap/coap_client.dart +++ b/lib/src/binding_coap/coap_client.dart @@ -531,12 +531,10 @@ final class CoapClient implements ProtocolClient { } @override - Future requestThingDescription(Uri url) async => - // TODO(JKRhb): Implement a different method here. - _sendDiscoveryRequest( + Future requestThingDescription(Uri url) async => _sendRequest( url, coap.RequestMethod.get, form: null, - format: coap.CoapMediaType.applicationTdJson, + accept: coap.CoapMediaType.applicationTdJson, ); } diff --git a/lib/src/binding_http/http_client.dart b/lib/src/binding_http/http_client.dart index c3909ff6..b2b3aeeb 100644 --- a/lib/src/binding_http/http_client.dart +++ b/lib/src/binding_http/http_client.dart @@ -328,8 +328,16 @@ final class HttpClient implements ProtocolClient { } @override - Future requestThingDescription(Uri url) { - // TODO: implement requestThingDescription - throw UnimplementedError(); + Future requestThingDescription(Uri url) async { + final request = Request(HttpRequestMethod.get.methodName, url); + const tdContentType = 'application/td+json'; + request.headers['Accept'] = tdContentType; + + final response = await _client.send(request); + + return Content( + response.headers['Content-Type'] ?? tdContentType, + response.stream, + ); } }