diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e354a807..fc7cf156a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,6 +51,11 @@ jobs: run: | sudo echo "127.0.0.1" `hostname` | sudo tee -a /etc/hosts + - name: Add missing ipv6 hostname to /etc/hosts + if: matrix.os == 'macos-latest' + run: | + sudo echo "::1" `hostname` | sudo tee -a /etc/hosts + # Enables the output of log messages from the Node.js debug module # for workflow runs that are being retried with "debug logging" # enabled. diff --git a/eslint.config.mjs b/eslint.config.mjs index 752c49bbd..1b44686fd 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -83,7 +83,7 @@ export default defineConfig([ "n/no-unsupported-features/node-builtins": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 "n/no-extraneous-import": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 - "n/no-deprecated-api": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 + "n/no-deprecated-api": "error", "n/no-unpublished-import": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 "n/no-process-exit": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 "n/hashbang": "warn", diff --git a/packages/binding-coap/src/coap-client.ts b/packages/binding-coap/src/coap-client.ts index d264c7cfe..f05cca5bf 100644 --- a/packages/binding-coap/src/coap-client.ts +++ b/packages/binding-coap/src/coap-client.ts @@ -209,7 +209,7 @@ export default class CoapClient implements ProtocolClient { public setSecurity = (metadata: Array): boolean => true; private uriToOptions(uri: string): CoapRequestParams { - const requestUri = url.parse(uri); + const requestUri = new url.URL(uri); const agentOptions = this.agentOptions; agentOptions.type = net.isIPv6(requestUri.hostname ?? "") ? "udp6" : "udp4"; this.agent = new Agent(agentOptions); @@ -219,7 +219,10 @@ export default class CoapClient implements ProtocolClient { hostname: requestUri.hostname ?? "", port: requestUri.port != null ? parseInt(requestUri.port, 10) : 5683, pathname: requestUri.pathname ?? "", - query: requestUri.query ?? "", + query: + requestUri.search && requestUri.search.length > 0 && requestUri.search[0] === "?" + ? requestUri.search.substring(1) + : "", observe: false, multicast: false, confirmable: true, diff --git a/packages/binding-coap/test/coap-server-test.ts b/packages/binding-coap/test/coap-server-test.ts index 9ab0fc540..e22e1f623 100644 --- a/packages/binding-coap/test/coap-server-test.ts +++ b/packages/binding-coap/test/coap-server-test.ts @@ -201,7 +201,7 @@ class CoapServerTest { } @test async "should support IPv6"() { - const coapServer = new CoapServer({ port: PORT, address: "::" }); + const coapServer = new CoapServer({ port: PORT, address: "::1" }); await coapServer.start(new Servient()); const testThing = new ExposedThing(new Servient(), {