-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Debug "mo:base/Debug"; | ||
import Text "mo:base/Text"; | ||
|
||
import { Backend } "../Backend"; | ||
|
||
let backend = await Backend(); | ||
|
||
let cases = [ | ||
("/services/oembed?format=xml&url=https%3A%2F%2Fembed.smartcontracts.org%2Fabcdef&maxheight=800&lines=5", "<?xml version=\221.0\22 encoding=\22utf-8\22 standalone=\22yes\22?><oembed><version>1.0</version><provider_name>Embed Motoko</provider_name><provider_url>https://embed.motoko.org</provider_url><type>rich</type><width>800</width><height>285</height><html><iframe src="https://embed.smartcontracts.org/abcdef" width="800" height="285" style="border:0" /></html></oembed>"), | ||
]; | ||
|
||
for ((url, expected) in cases.vals()) { | ||
Debug.print(url); | ||
let request = { | ||
method = "GET"; | ||
headers = []; | ||
url; | ||
body = "" : Blob; | ||
}; | ||
let received = (await backend.http_request(request)).body; | ||
Debug.print(debug_show Text.decodeUtf8(received)); | ||
assert received == Text.encodeUtf8(expected); | ||
Debug.print(""); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters