MCPcopy Create free account
hub / github.com/form-data/form-data / submitForm

Function submitForm

test/integration/test-submit-https.js:13–39  ·  view source on GitHub ↗

* Test submission to HTTPS endpoint

()

Source from the content-addressed store, hash-verified

11 * Test submission to HTTPS endpoint
12 */
13function submitForm() {
14 var form = new FormData();
15
16 form.append('field', 'value');
17
18 form.submit({
19 protocol: 'https:',
20 hostname: 'localhost',
21 port: common.httpsPort,
22 pathname: '/',
23 // for self-signed certs on localhost
24 secureOptions: constants.SSL_OP_NO_TLSv1_2,
25 ca: common.httpsServerCert
26 }, function (err, res) {
27 if (err) {
28 throw err;
29 }
30
31 assert.strictEqual(res.statusCode, 200);
32 assert.strictEqual(res.headers['x-success'], 'OK');
33
34 // unstuck new streams
35 res.resume();
36
37 server.close();
38 });
39}
40
41// create https server
42server = https.createServer({

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected