@@ -7,7 +7,7 @@ const { Formidable } = require('../src/index');
7
7
8
8
const server = http . createServer ( ( req , res ) => {
9
9
if ( req . url === '/' ) {
10
- res . writeHead ( 200 , { 'content-type ' : 'text/html' } ) ;
10
+ res . writeHead ( 200 , { 'Content-Type ' : 'text/html' } ) ;
11
11
res . end ( `
12
12
<form action="/post" method="post">
13
13
Title: <input type="text" name="title" /><br />
@@ -22,7 +22,7 @@ const server = http.createServer((req, res) => {
22
22
form
23
23
. on ( 'error' , ( err ) => {
24
24
console . log ( 'err!' , err ) ;
25
- res . writeHead ( 200 , { 'content-type ' : 'text/plain' } ) ;
25
+ res . writeHead ( 200 , { 'Content-Type ' : 'text/plain' } ) ;
26
26
res . end ( `error:\n\n${ util . inspect ( err ) } ` ) ;
27
27
} )
28
28
. on ( 'field' , ( fieldName , fieldValue ) => {
@@ -33,17 +33,17 @@ const server = http.createServer((req, res) => {
33
33
} )
34
34
. on ( 'end' , ( ) => {
35
35
console . log ( '-> post done from "end" event' ) ;
36
- res . writeHead ( 200 , { 'content-type ' : 'text/plain' } ) ;
36
+ res . writeHead ( 200 , { 'Content-Type ' : 'text/plain' } ) ;
37
37
res . end ( `received fields:\n\n${ util . inspect ( fields ) } ` ) ;
38
38
} ) ;
39
39
40
40
form . parse ( req , ( ) => {
41
41
console . log ( '-> post done from callback' ) ;
42
- // res.writeHead(200, { 'content-type ': 'text/plain' });
42
+ // res.writeHead(200, { 'Content-Type ': 'text/plain' });
43
43
// res.end(`received fields:\n\n${util.inspect(fields)}`);
44
44
} ) ;
45
45
} else {
46
- res . writeHead ( 404 , { 'content-type ' : 'text/plain' } ) ;
46
+ res . writeHead ( 404 , { 'Content-Type ' : 'text/plain' } ) ;
47
47
res . end ( '404' ) ;
48
48
}
49
49
} ) ;
0 commit comments