Add syntax highlighting in egui web fetch example

This commit is contained in:
Emil Ernerfeldt
2020-12-28 19:55:03 +01:00
parent 2870001544
commit 07e96ca17f
8 changed files with 435 additions and 181 deletions
+3 -1
View File
@@ -67,7 +67,9 @@ async fn fetch_jsvalue(method: &str, url: &str) -> Result<Response, JsValue> {
.flatten()
.unwrap_or_default();
let text = if header_content_type.starts_with("text") {
let text = if header_content_type.starts_with("text")
|| header_content_type == "application/javascript"
{
String::from_utf8(bytes.clone()).ok()
} else {
None