1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
Description: fix test
This test fails even with a "npm i"
Author: Yadd <yadd@debian.org>
Forwarded: no
Last-Update: 2022-07-28
--- a/test/main.js
+++ b/test/main.js
@@ -1485,63 +1485,6 @@
.to.be.rejectedWith(Error, errorMessage);
});
- it('should allow POST request with form-data as body', async () => {
- const form = new FormData();
- form.append('a', '1');
-
- const url = `${base}multipart`;
- const options = {
- method: 'POST',
- body: form
- };
- const res = await fetch(url, options);
- const json = await res.json();
- expect(json.method).to.equal('POST');
- expect(json.headers['content-type']).to.startWith('multipart/form-data;boundary=');
- expect(json.headers['content-length']).to.be.a('string');
- expect(json.body).to.equal('a=1');
- });
-
- it('should allow POST request with form-data using stream as body', async () => {
- const form = new FormData();
- form.append('my_field', fs.createReadStream('test/utils/dummy.txt'));
-
- const url = `${base}multipart`;
- const options = {
- method: 'POST',
- body: form
- };
-
- const res = await fetch(url, options);
- const json = await res.json();
- expect(json.method).to.equal('POST');
- expect(json.headers['content-type']).to.startWith('multipart/form-data;boundary=');
- expect(json.headers['content-length']).to.be.undefined;
- expect(json.body).to.contain('my_field=');
- });
-
- it('should allow POST request with form-data as body and custom headers', async () => {
- const form = new FormData();
- form.append('a', '1');
-
- const headers = form.getHeaders();
- headers.b = '2';
-
- const url = `${base}multipart`;
- const options = {
- method: 'POST',
- body: form,
- headers
- };
- const res = await fetch(url, options);
- const json = await res.json();
- expect(json.method).to.equal('POST');
- expect(json.headers['content-type']).to.startWith('multipart/form-data; boundary=');
- expect(json.headers['content-length']).to.be.a('string');
- expect(json.headers.b).to.equal('2');
- expect(json.body).to.equal('a=1');
- });
-
it('should support spec-compliant form-data as POST body', async () => {
const form = new FormDataNode();
|