Skip to content

Instantly share code, notes, and snippets.

@adoyle-h
Created March 27, 2016 07:09
Show Gist options
  • Save adoyle-h/4be2e24b0cc517fd426b to your computer and use it in GitHub Desktop.
Save adoyle-h/4be2e24b0cc517fd426b to your computer and use it in GitHub Desktop.
var http = require('http');
var targetUrl = 'https://www.douban.com/';
var body = '<html>'
+ '<head></head>'
+ '<body>'
+ '<form action="' + targetUrl + '" method="POST">'
+ '<input type="text" name="hello" value="world"/>'
+ '</form>'
+ '<script> document.forms[0].submit();</script>'
+ '</body>'
'</html>';
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.write(body);
response.end();
}).listen(8888);
console.log('访问 http://127.0.0.1:8888/ ,去看 POST 请求是否发送了 cookie!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment