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 ?)
pull/18777/head
Sébastien Bocahu 10 years ago committed by Matt Clay
parent 5de4c053b6
commit f88f895795

@ -66,7 +66,7 @@ options:
default: null
body_format:
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
default: raw
method:
@ -340,7 +340,7 @@ def main():
user = dict(required=False, default=None),
password = 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']),
return_content = 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 = {}
# 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':
body = json.dumps(body)
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"}')

Loading…
Cancel
Save