[CONTROLLER-750] JSON response for non matching endtag with header containing accept application/xml Created: 01/Sep/14  Updated: 25/Jul/23  Resolved: 17/Sep/14

Status: Resolved
Project: controller
Component/s: restconf
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: RichardHill Assignee: Jozef Gloncak
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Windows
Platform: PC


External issue ID: 1659

 Description   

When making the request below a JSON response was received when a XML format was expected.

Adding a flow with a non matching end tag.

'method': 'POST',
'uri': '/config/opendaylight-inventory:nodes/node/foo:node:18/table/18',
'headers':

{'content-type': 'application/xml','accept':'application/xml'}

,
'data': '''<flow xmlns="urn:opendaylight:flow:inventory">
<id>18</id>
<instructions>
<instruction>
<order>0</order>
</instruction>
</flow>''',
'expected_status': 400,
'expected': '''<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"><error><error-type>protocol</error-type><error-tag>malformed-message</error-tag><error-message>Error parsing input: ParseError at [row,col]:[7,3] Message: The element type "instructions" must be terminated by the matching end-tag "</instructions>".</error-message></error></errors>'''

RECEIVED

{'errors': {'error':

{'error-type': 'protocol', 'error-tag': 'malformed-message', 'error-message': 'error parsing input: parseerror at [row,col]:[7,3]\nmessage: the element type "instructions" must be terminated by the matching end-tag "</instructions>".'}

}}

TEST ENV

org.opendaylight.controller.version = 0.1
org.opendaylight.controller.build.scm.version = 78fec1c1c5a3720bd48d1044703824626f08b5d9
org.opendaylight.controller.build.user = jenkins-controller
org.opendaylight.controller.build.workspace = **********
org.opendaylight.controller.build.timestamp = 1409283738738
org.opendaylight.controller.build.machine = **********
~

STEPS
Used the cisco-sp artifact athttp://sn-bldsg.cisco.com/jenkins/job/ODL-CISCO-SP/1649/ no special configuration needed. I will repeat the test with the ODL SP edition.



 Comments   
Comment by Tony Tkacik [ 08/Sep/14 ]

Please provide steps to reproduce, since I was unable to reproduce it using Postman and request you provided.

Comment by Tony Tkacik [ 09/Sep/14 ]

Could not replicate on current master and 1 week old master.

Comment by RichardHill [ 12/Sep/14 ]

As you discussed later this was due to postman sanitising the HTTP headers so reopening the bug.

Comment by Jozef Gloncak [ 16/Sep/14 ]

patch set
https://git.opendaylight.org/gerrit/11234

Returning value (errors or data) will be by default in JSON format.

Generated at Wed Feb 07 19:53:46 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.