mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-11-28 05:52:21 +03:00
Enable Headers interface part of fetch API (#463)
This commit is contained in:
parent
2007fe6b9c
commit
1007449a17
33
crates/web-sys/tests/all/headers.rs
Normal file
33
crates/web-sys/tests/all/headers.rs
Normal 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();
|
||||
}
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user