1- using System ;
1+ using System ;
22using System . Collections . Generic ;
33using System . Linq ;
44using FluentAssertions ;
@@ -56,6 +56,24 @@ public override IEnumerable<ValueTuple<string, Renor[]>> GetValues()
5656 new Request ( 4 , "subtract" , JObject . FromObject ( new { minuend = 42 , subtrahend = 23 } ) )
5757 } ) ;
5858
59+ yield return (
60+ @"{""jsonrpc"": ""2.0"", ""method"": ""subtract"", ""id"": 4}" ,
61+ new Renor [ ]
62+ {
63+ new Request ( 4 , "subtract" , null )
64+ } ) ;
65+
66+ // http://www.jsonrpc.org/specification says:
67+ // If present, parameters for the rpc call MUST be provided as a Structured value.
68+ // Some clients may serialize params as null, instead of omitting it
69+ // We're going to pretend we never got the null in the first place.
70+ yield return (
71+ @"{""jsonrpc"": ""2.0"", ""method"": ""subtract"", ""params"": null, ""id"": 4}" ,
72+ new Renor [ ]
73+ {
74+ new Request ( 4 , "subtract" , null )
75+ } ) ;
76+
5977 yield return (
6078 @"{""jsonrpc"": ""2.0"", ""method"": ""update"", ""params"": [1,2,3,4,5]}" ,
6179 new Renor [ ]
@@ -70,6 +88,17 @@ public override IEnumerable<ValueTuple<string, Renor[]>> GetValues()
7088 new Notification ( "foobar" , null )
7189 } ) ;
7290
91+ // http://www.jsonrpc.org/specification says:
92+ // If present, parameters for the rpc call MUST be provided as a Structured value.
93+ // Some clients may serialize params as null, instead of omitting it
94+ // We're going to pretend we never got the null in the first place.
95+ yield return (
96+ @"{""jsonrpc"": ""2.0"", ""method"": ""foobar"", ""params"": null}" ,
97+ new Renor [ ]
98+ {
99+ new Notification ( "foobar" , null )
100+ } ) ;
101+
73102 yield return (
74103 @"{""jsonrpc"": ""2.0"", ""method"": 1, ""params"": ""bar""}" ,
75104 new Renor [ ]
@@ -144,4 +173,4 @@ public override IEnumerable<ValueTuple<string, bool>> GetValues()
144173 }
145174 }
146175 }
147- }
176+ }
0 commit comments