mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-12 23:56:13 +01:00
- become curl compatible, switch to "PUT" method when using -T upload file parameter
This commit is contained in:
parent
f98758e902
commit
da7445c192
@ -6092,7 +6092,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
@cmdln.option('-d', '--data', default=None, metavar='STRING',
|
||||
help='specify string data for e.g. POST')
|
||||
@cmdln.option('-T', '-f', '--file', default=None, metavar='FILE',
|
||||
help='specify filename for e.g. PUT or DELETE')
|
||||
help='specify filename to upload, uses PUT mode by default')
|
||||
@cmdln.option('-a', '--add-header', default=None, metavar='NAME STRING',
|
||||
nargs=2, action='append', dest='headers',
|
||||
help='add the specified header to the request')
|
||||
@ -6119,6 +6119,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if not opts.method in ['GET', 'PUT', 'POST', 'DELETE']:
|
||||
sys.exit('unknown method %s' % opts.method)
|
||||
|
||||
# default is PUT when uploading files
|
||||
if opts.file and opts.method == 'GET':
|
||||
opts.method = 'PUT'
|
||||
|
||||
if not url.startswith('http'):
|
||||
if not url.startswith('/'):
|
||||
url = '/' + url
|
||||
|
Loading…
Reference in New Issue
Block a user