File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,11 @@ private static HttpRequestContext ToHttpRequestContext (this RpcHttp rpcHttp)
5858
5959 if ( rpcHttp . RawBody != null )
6060 {
61- httpRequestContext . RawBody = rpcHttp . RawBody . ToObject ( ) ;
61+ object rawBody = rpcHttp . RawBody . DataCase == TypedData . DataOneofCase . String
62+ ? rpcHttp . RawBody . String
63+ : rpcHttp . RawBody . ToObject ( ) ;
64+
65+ httpRequestContext . RawBody = rawBody ;
6266 }
6367
6468 return httpRequestContext ;
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ public void TestTypedDataToObjectHttpRequestContextBodyData()
9090 var method = "Get" ;
9191 var url = "https://example.com" ;
9292 var data = "Hello World" ;
93+ var rawData = "{\" Foo\" :\" Bar\" }" ;
9394
9495 var input = new TypedData
9596 {
@@ -103,7 +104,7 @@ public void TestTypedDataToObjectHttpRequestContextBodyData()
103104 } ,
104105 RawBody = new TypedData
105106 {
106- String = data
107+ String = rawData
107108 }
108109 }
109110 } ;
@@ -121,7 +122,7 @@ public void TestTypedDataToObjectHttpRequestContextBodyData()
121122 Assert . Equal ( httpRequestContext . Method , method ) ;
122123 Assert . Equal ( httpRequestContext . Url , url ) ;
123124 Assert . Equal ( httpRequestContext . Body , data ) ;
124- Assert . Equal ( httpRequestContext . RawBody , data ) ;
125+ Assert . Equal ( httpRequestContext . RawBody , rawData ) ;
125126 Assert . Empty ( httpRequestContext . Headers ) ;
126127 Assert . Empty ( httpRequestContext . Params ) ;
127128 Assert . Empty ( httpRequestContext . Query ) ;
You can’t perform that action at this time.
0 commit comments