Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
Helium
-
None
-
None
-
Operating System: Linux
Platform: PC
-
1010
Description
Requests to restconf API should always return data in the appropriate content type.
Currently, returns errors either as plain text string:
$ curl -X POST -H 'Content-Type: application/yang.data+json' -d '{toaster:{darknessFactor: "2000"}}' http://localhost:8080/restconf/config/toaster:toaster
Data has bad format. Root element node must have namespace (XML format) or module name(JSON format)
or as an HTML formatted exception:
$ curl -X POST -H 'Content-Type: application/yang.data+json' -d '{"toaster:toaster":{"darknessFactor": "2000"}}' http://localhost:8080/restconf/config/toaster:toaster
<html><head><title>Apache Tomcat/7.0.32 - Error report</title><style><!--H1
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name
{color : black;}HR
{color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.NullPointerException
com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper.unwrap(SimpleNodeWrapper.java:82)
org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper.unwrap(SimpleNodeWrapper.java:21)
org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper.unwrap(CompositeNodeWrapper.java:109)
org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper.getNodeType(CompositeNodeWrapper.java:123)
<SNIP>