Inject parity script to all dapps // Expand dapps to any ZIP file (#7260)

* Inject Parity script to all HTML dapps pages

* Small glitch

* Add injection test

* Add Special GHH commit value for serving ZIP files as DAPPS

* Refactor GithubDapp fetcher

* PR Grumbles
This commit is contained in:
Nicolas Gotchac
2017-12-13 07:56:35 +01:00
committed by Svyatoslav Nikolsky
parent f3297dd44a
commit 82d7fc54b3
6 changed files with 125 additions and 45 deletions

View File

@@ -60,3 +60,32 @@ fn should_serve_home() {
response.assert_header("Content-Type", "text/html");
assert_security_headers(&response.headers);
}
#[test]
fn should_inject_js() {
// given
let server = serve_ui();
// when
let response = request(server,
"\
GET / HTTP/1.1\r\n\
Host: 127.0.0.1:8080\r\n\
Connection: close\r\n\
\r\n\
{}
"
);
// then
response.assert_status("HTTP/1.1 200 OK");
response.assert_header("Content-Type", "text/html");
assert_eq!(
response.body.contains(r#"/inject.js"></script>"#),
true,
"Expected inject script tag in: {}",
response.body
);
assert_security_headers(&response.headers);
}