Enable Headers interface part of fetch API (#463)

This commit is contained in:
Michael Hoffmann 2018-07-13 19:11:06 +02:00 committed by Alex Crichton
parent 2007fe6b9c
commit 1007449a17
3 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,33 @@
use super::websys_project;
#[test]
fn headers() {
websys_project()
.file(
"src/lib.rs",
r#"
#![feature(proc_macro, wasm_custom_section)]
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
extern crate web_sys;
#[wasm_bindgen]
pub fn test_headers(_headers: &web_sys::Headers) {
// empty for now...
}
"#,
)
.file(
"test.js",
r#"
import * as assert from "assert";
import * as wasm from "./out";
export function test() {
let headers = new Headers({'Content-Type': 'text/plain'});
wasm.test_headers(headers);
}
"#,
)
.test();
}

View File

@ -2,6 +2,7 @@ extern crate wasm_bindgen_test_project_builder as project_builder;
use project_builder::{project, Project};
mod event;
mod headers;
mod response;
fn websys_project() -> Project {