代码之家  ›  专栏  ›  技术社区  ›  HappyNomad

从hub方法内部查看hub方法参数的原始JSON

  •  0
  • HappyNomad  · 技术社区  · 4 年前

    public async Task<string> ApplyChanges( IEnumerable<Document> docs )
    {
        ...
    }
    

    出于调试目的,我想 docs 作为原始JSON,即反序列化之前的JSON。我知道我可以改变 JToken 但这还不足以满足我现在的需要。我真的需要看看实际的预反序列化JSON文本。

    var request = Context.GetHttpContext().Request;
    string content;
    using ( var reader = new StreamReader( request.Body ) ) {
        content = await reader.ReadToEndAsync();
    }
    

    Request 无济于事。

    0 回复  |  直到 4 年前