make request method a post when there is --data

This commit is contained in:
Nick Carneiro
2014-12-31 11:26:57 -06:00
parent dc0d5092d4
commit b9a0832444
2 changed files with 2 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ var parseCurlCode_ = function(curlCommand) {
};
cookies = cookie.parse(cookieString.replace('Cookie: ', ''), cookieParseOptions);
}
var method = getopt.options.method === 'POST' ? 'post' : 'get';
var method = getopt.options.method === 'POST' || getopt.options.data ? 'post' : 'get';
var request = {
url: url,
headers: headers,

View File

@@ -12,4 +12,4 @@ headers = {
data = 'msg1=wow&msg2=such'
requests.get('http://fiddle.jshell.net/echo/html/', headers=headers, data=data)
requests.post('http://fiddle.jshell.net/echo/html/', headers=headers, data=data)