[stable-2.8] Fix RESTCONF media types (#58015)

Fixes #56680
(cherry picked from commit f656959)

Co-authored-by: Nathaniel Case <ncase@redhat.com>
This commit is contained in:
Nathaniel Case 2019-06-19 10:22:24 -04:00 committed by Toshio Kuratomi
parent ab50e41a4c
commit 378ddec5c6
3 changed files with 5 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Fix media type of RESTCONF requests.

View file

@ -39,7 +39,7 @@ def get(module, path=None, content=None, fields=None, output='json'):
accept = None
if output == 'xml':
accept = 'application/yang.data+xml'
accept = 'application/yang-data+xml'
connection = Connection(module._socket_path)
return connection.send_request(None, path=path, method='GET', accept=accept)
@ -51,7 +51,7 @@ def edit_config(module, path=None, content=None, method='GET', format='json'):
content_type = None
if format == 'xml':
content_type = 'application/yang.data+xml'
content_type = 'application/yang-data+xml'
connection = Connection(module._socket_path)
return connection.send_request(content, path=path, method=method, content_type=content_type)

View file

@ -48,7 +48,7 @@ from ansible.module_utils.six.moves.urllib.error import HTTPError
from ansible.plugins.httpapi import HttpApiBase
CONTENT_TYPE = 'application/yang.data+json'
CONTENT_TYPE = 'application/yang-data+json'
class HttpApi(HttpApiBase):