mirror of
				https://github.com/curlconverter/curlconverter.git
				synced 2022-05-22 02:35:29 +03:00 
			
		
		
		
	make request method a post when there is --data
This commit is contained in:
		
							
								
								
									
										2
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								index.js
									
									
									
									
									
								
							@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
		Reference in New Issue
	
	Block a user