Title: Exception because a request object has an invalid id · Issue #109 · Astn/JSON-RPC.NET · GitHub
Open Graph Title: Exception because a request object has an invalid id · Issue #109 · Astn/JSON-RPC.NET
X Title: Exception because a request object has an invalid id · Issue #109 · Astn/JSON-RPC.NET
Description: Consider this new test case. It contains a request with an object as the id attribute. This is against the 2.0 specification: [Test()] public void TestWrongIdType() { string request = @"{method:'TestOptionalParamdouble',params:{input:5},...
Open Graph Description: Consider this new test case. It contains a request with an object as the id attribute. This is against the 2.0 specification: [Test()] public void TestWrongIdType() { string request = @"{method:'Te...
X Description: Consider this new test case. It contains a request with an object as the id attribute. This is against the 2.0 specification: [Test()] public void TestWrongIdType() { string request = @"{metho...
Opengraph URL: https://github.com/Astn/JSON-RPC.NET/issues/109
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Exception because a request object has an invalid id","articleBody":"Consider this new test case. It contains a request with an object as the id attribute. This is against the 2.0 specification: \r\n\r\n```\r\n[Test()]\r\npublic void TestWrongIdType()\r\n{\r\n string request = @\"{method:'TestOptionalParamdouble',params:{input:5},id:{what:4,that:3}}\";\r\n var result = JsonRpcProcessor.Process(request);\r\n result.Wait();\r\n Assert.IsTrue(result.Result.Contains(\"error\"));\r\n}\r\n```\r\n\r\nIt fails throwing an ugly exception because the 'id' attribute is an object instead of a simple value. \r\nThe right solution should be to complain about the malformed request returning a -32600 code, and refuse to process the request altogether, instead of failing when serializing the response. Another option, unorthodox but easy to fix, would be to allow objects in the id attribute. \r\n \r\nComplete stack trace:\r\n\r\n```\r\nNewtonsoft.Json.JsonWriterException\r\n HResult=0x80131500\r\n Message=Unsupported type: Newtonsoft.Json.Linq.JObject. Use the JsonSerializer class to get the object's JSON representation. Path ''.\r\n Source=Newtonsoft.Json\r\n StackTrace:\r\n at Newtonsoft.Json.JsonWriter.WriteValue(JsonWriter writer, PrimitiveTypeCode typeCode, Object value)\r\n at Newtonsoft.Json.JsonWriter.WriteValue(Object value)\r\n at Newtonsoft.Json.JsonTextWriter.WriteValue(Object value)\r\n at AustinHarris.JsonRpc.JsonRpcProcessor.ProcessInternal(String sessionId, String jsonRpc, Object jsonRpcContext) in C:\\Users\\plopezc\\source\\repos\\JsonRpcNet\\Json-Rpc\\JsonRpcProcessor.cs:line 135\r\n at AustinHarris.JsonRpc.JsonRpcProcessor.\u003c\u003ec.\u003cProcess\u003eb__3_0(Object _) in C:\\Users\\plopezc\\source\\repos\\JsonRpcNet\\Json-Rpc\\JsonRpcProcessor.cs:line 39\r\n at System.Threading.Tasks.Task`1.InnerInvoke()\r\n at System.Threading.Tasks.Task.Execute()\r\n\r\n```","author":{"url":"https://github.com/pedrolcl","@type":"Person","name":"pedrolcl"},"datePublished":"2019-09-26T07:30:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/109/JSON-RPC.NET/issues/109"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e24b622b-88fa-0259-8406-b23a0768af81 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD54:BFBA6:47561A2:5BC9427:69912E2C |
| html-safe-nonce | b1ab5b816ce00ae30e4562321dab9c587ab0eacd12edf6ea21d296ddd4bde7fa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDU0OkJGQkE2OjQ3NTYxQTI6NUJDOTQyNzo2OTkxMkUyQyIsInZpc2l0b3JfaWQiOiIzNzU3NTY1NjEzNzEyNjgyNTQwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2d1d3e55f0573f17d66fdb8757bd3f4fdadef6e4322a4142c1828e677dbfabc8 |
| hovercard-subject-tag | issue:498709908 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Astn/JSON-RPC.NET/109/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ab28e73d77058884d03c542726ee77a5751d4c9a256ee339dbf854a45ac9e4be/Astn/JSON-RPC.NET/issues/109 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ab28e73d77058884d03c542726ee77a5751d4c9a256ee339dbf854a45ac9e4be/Astn/JSON-RPC.NET/issues/109 |
| og:image:alt | Consider this new test case. It contains a request with an object as the id attribute. This is against the 2.0 specification: [Test()] public void TestWrongIdType() { string request = @"{method:'Te... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pedrolcl |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/Astn/JSON-RPC.NET git https://github.com/Astn/JSON-RPC.NET.git |
| octolytics-dimension-user_id | 6857743 |
| octolytics-dimension-user_login | Astn |
| octolytics-dimension-repository_id | 17465376 |
| octolytics-dimension-repository_nwo | Astn/JSON-RPC.NET |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 17465376 |
| octolytics-dimension-repository_network_root_nwo | Astn/JSON-RPC.NET |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width