1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Removed the "implicit_content_type" config option

If you used:

    "implicit_content_type": "form"

 You can achieve the the same result with:

     "default_options": ["--form"]

If you used:

    "implicit_content_type": "json"

 Then it's the default behaviour and it can be removed.

 In either case HTTPie will migrate your config file on the next invocation.
This commit is contained in:
Jakub Roztocil
2016-03-03 17:14:39 +08:00
parent 5dbd104c3b
commit 20823c1702
6 changed files with 80 additions and 34 deletions

View File

@@ -84,7 +84,6 @@ class Config(BaseConfigDict):
about = 'HTTPie configuration file'
DEFAULTS = {
'implicit_content_type': 'json',
'default_options': []
}
@@ -93,5 +92,21 @@ class Config(BaseConfigDict):
self.update(self.DEFAULTS)
self.directory = directory
def load(self):
super(Config, self).load()
self._migrate_implicit_content_type()
def _get_path(self):
return os.path.join(self.directory, self.name + '.json')
def _migrate_implicit_content_type(self):
"""Migrate the removed implicit_content_type config option"""
try:
implicit_content_type = self.pop('implicit_content_type')
except KeyError:
pass
else:
if implicit_content_type == 'form':
self['default_options'].insert(0, '--form')
self.save()
self.load()