From ce190fd41f87eb5bb5181136e274aa001a6efb73 Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Wed, 4 Dec 2024 09:24:07 +0000 Subject: [PATCH] Update example to use http request 2 --- examples/service-alias/service-alias.sol | 9 ++++++--- lib/suave-std | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/service-alias/service-alias.sol b/examples/service-alias/service-alias.sol index d6f127b..a9f57b0 100644 --- a/examples/service-alias/service-alias.sol +++ b/examples/service-alias/service-alias.sol @@ -13,13 +13,16 @@ contract ServiceAlias is Suapp { request.method = "GET"; request.timeout = 1000; - bytes memory response1 = Suave.doHTTPRequest(request); + Suave.HttpResponse memory response1 = Suave.doHTTPRequest2(request); // Make the request to the http endpoint request.url = "https://example.com"; - bytes memory response2 = Suave.doHTTPRequest(request); + Suave.HttpResponse memory response2 = Suave.doHTTPRequest2(request); - require(keccak256(response1) == keccak256(response2), "Strings should be equal"); + require(response1.status == 200, "Status should be 200"); + require(response2.status == 200, "Status should be 200"); + + require(keccak256(response1.body) == keccak256(response2.body), "Strings should be equal"); return abi.encodeWithSelector(this.exampleCallback.selector); } } diff --git a/lib/suave-std b/lib/suave-std index 26d649b..796452e 160000 --- a/lib/suave-std +++ b/lib/suave-std @@ -1 +1 @@ -Subproject commit 26d649b0540d0c233e58b1efad3438607f81451a +Subproject commit 796452ebbdc5496a0e16d4eaf5fb06d54626604f