Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example to use http request 2 #70

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions examples/service-alias/service-alias.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Loading