Removes YAML body_format option

It would require adding a dependency to the YAML module while it might
not provide much benefit (has anybody seen a HTTP API taking YAML as
input ?)
reviewable/pr18780/r1
Sébastien Bocahu 10 years ago
parent 6b20c3890f
commit b2d570e991

@ -66,7 +66,7 @@ options:
default: null default: null
body_format: body_format:
description: description:
- The serialization format of the body. Either raw, json, or yaml. When set to json or yaml, encodes the body argument and automatically sets the Content-Type header accordingly. - The serialization format of the body. Either raw, or json. When set to json, encodes the body argument and automatically sets the Content-Type header accordingly.
required: false required: false
default: raw default: raw
method: method:
@ -340,7 +340,7 @@ def main():
user = dict(required=False, default=None), user = dict(required=False, default=None),
password = dict(required=False, default=None), password = dict(required=False, default=None),
body = dict(required=False, default=None), body = dict(required=False, default=None),
body_format = dict(required=False, default='raw', choices=['raw', 'json', 'yaml']), body_format = dict(required=False, default='raw', choices=['raw', 'json']),
method = dict(required=False, default='GET', choices=['GET', 'POST', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'PATCH']), method = dict(required=False, default='GET', choices=['GET', 'POST', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'PATCH']),
return_content = dict(required=False, default='no', type='bool'), return_content = dict(required=False, default='no', type='bool'),
force_basic_auth = dict(required=False, default='no', type='bool'), force_basic_auth = dict(required=False, default='no', type='bool'),
@ -376,13 +376,10 @@ def main():
dict_headers = {} dict_headers = {}
# If body_format is json or yaml, encore the body (wich can be a dict or a list) and automatically sets the Content-Type header # If body_format is json, encodes the body (wich can be a dict or a list) and automatically sets the Content-Type header
if body_format == 'json': if body_format == 'json':
body = json.dumps(body) body = json.dumps(body)
dict_headers['Content-Type'] = 'application/json' dict_headers['Content-Type'] = 'application/json'
elif body_format == 'yaml':
body = yaml.dump(body)
dict_headers['Content-Type'] = 'application/yaml'
# Grab all the http headers. Need this hack since passing multi-values is currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}') # Grab all the http headers. Need this hack since passing multi-values is currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}')

Loading…
Cancel
Save