[CONTROLLER-472] Restconf errors should be formatted in JSON as appropropriate Created: 14/May/14 Updated: 27/May/14 Resolved: 27/May/14 |
|
| Status: | Resolved |
| Project: | controller |
| Component/s: | restconf |
| Affects Version/s: | Helium |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Rob Adams | Assignee: | Tom Pantelis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: Linux |
||
| External issue ID: | 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 or as an HTML formatted exception: 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 |
| Comments |
| Comment by Tom Pantelis [ 16/May/14 ] |
|
In addition to returning error data in the appropriate content type, error data should also be returned in the form described by the "errors" schema in the RESTCONF RFC section 6: https://tools.ietf.org/html/draft-bierman-netconf-restconf-02#section-6. |
| Comment by Tom Pantelis [ 16/May/14 ] |
|
I have prototyped the changes but it depends on the current work to add the missing ietf-restconf yang module which hopefully should get merged soon. |
| Comment by Tom Pantelis [ 20/May/14 ] |
|
Pushed draft: |