Files
test-repo/tests/flow/fetch/response.js
T
Christopher Chedeau 3375cfe605 Move tests around (#454)
* new_tests

* move_all_clobbered_tests

* remove all the tests that no longer exist

* re-run flow tests

* Move all the flow tests to tests/flow and prettier to tests/

* Move prettier tests to their own folders

* Add jsfmt files

* run prettier snapshot tests
2017-01-24 14:35:37 -08:00

47 lines
1.2 KiB
JavaScript

/* @flow */
const a: Response = new Response(); // correct
const b: Response = new Response(new Blob()); // correct
const c: Response = new Response(new FormData()); // correct
const d: Response = new Response(new FormData(), {
status: 404
}); // correct
const e: Response = new Response("responsebody", {
status: "404"
}); // incorrect
const f: Response = new Response("responsebody", {
status: 404,
headers: "'Content-Type': 'image/jpeg'"
}); // incorrect
const g: Response = new Response("responsebody", {
status: 404,
headers: {
'Content-Type': 'image/jpeg'
}
}); // correct
const h: Response = new Response("responsebody", {
status: 404,
headers: new Headers({
'Content-Type': 'image/jpeg'
})
}); // correct, if verbose
const i: Response = new Response({
status: 404,
headers: new Headers({
'Content-Type': 'image/jpeg'
})
}); // incorrect
const ok: boolean = h.ok;
const status: number = h.status;
h.text().then((t: string) => t); // correct
h.text().then((t: Buffer) => t); // incorrect
h.arrayBuffer().then((ab: ArrayBuffer) => ab); // correct
h.arrayBuffer().then((ab: Buffer) => ab); // incorrect