47 lines
1.2 KiB
JavaScript
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
|