diff --git a/README.md b/README.md index 5bf971f..6b01dca 100644 --- a/README.md +++ b/README.md @@ -48,17 +48,17 @@ Console.WriteLine($"Id: {userDto.Id}, Name: {userDto.Name}, CreateDate: {userDto ``` #### ServerStreaming -> not support +> not supported #### DuplexStreaming -> not support +> not supported ## Roadmap -- [x] Unary support. +- [x] Unary supported. -- [x] ClientStreaming support. +- [x] ClientStreaming supported. -- [ ] ServerStreaming support. +- [ ] ServerStreaming supported. -- [ ] DuplexStreaming support. +- [ ] DuplexStreaming supported. diff --git a/sample/ServerSample/Startup.cs b/sample/ServerSample/Startup.cs index a94fb15..61f042e 100644 --- a/sample/ServerSample/Startup.cs +++ b/sample/ServerSample/Startup.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Text; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -17,6 +18,8 @@ public class Startup { public void ConfigureServices(IServiceCollection services) { + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json", false, true).Build(); //services.AddSingleton(); diff --git a/sample/ServerSample/UserService.cs b/sample/ServerSample/UserService.cs index 36ea1ee..3e574a0 100644 --- a/sample/ServerSample/UserService.cs +++ b/sample/ServerSample/UserService.cs @@ -1,5 +1,7 @@ using System; using System.Text.Json; +using System.Text.Encodings.Web; +using System.Text.Unicode; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -10,6 +12,7 @@ namespace ServerSample { public class UserService : RpcServiceBase, IUserService { + private static readonly JsonSerializerOptions _options = new JsonSerializerOptions { Encoder = JavaScriptEncoder.Create(UnicodeRanges.All) }; private readonly ILogger _logger; public UserService(ILoggerFactory loggerFactory) @@ -19,7 +22,7 @@ public UserService(ILoggerFactory loggerFactory) public Task GetUserBy(UserRequest request, CancellationToken token = default) { - this._logger.LogInformation($"Receive client message:{JsonSerializer.Serialize(request)}"); + this._logger.LogInformation($"Receive client message:{JsonSerializer.Serialize(request, _options)}"); return Task.FromResult(new UserDto { diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 2dd74d1..4075d86 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -5,7 +5,7 @@ https://github.com/netcore-jroger/SimpleRpc https://github.com/netcore-jroger/SimpleRpc gRPC - 0.1.9 + 0.1.10 JRoger © 2019-2021 \ No newline at end of file