Exemplo n.º 1
0
 public JsonRpcProcessor(
     ICommandLocator commandLocator,
     IJsonRpcCommandTranslator translator,
     IJsonRpcHttpConverter converter,
     IJsonRpcRequestParser requestParser)
 {
     this.commandLocator = commandLocator;
     this.requestParser  = requestParser;
     this.translator     = translator;
     this.converter      = converter;
 }
Exemplo n.º 2
0
        public JsonRpcModule(IJsonSerializer jsonSerializer,
                             IJsonRpcRequestParser requestParser,
                             IRequestHandler requestHandler)
        {
            Post["/jsonrpc"] = _ =>
            {
                this.RequiresAuthentication();

                using (var ms = new MemoryStream())
                {
                    Request.Body.CopyTo(ms);

                    var json     = Encoding.UTF8.GetString(ms.ToArray());
                    var request  = requestParser.Parse(json);
                    var response = requestHandler.Handle(request);

                    return(Response.AsText(jsonSerializer.SerializeObject(response), "application/json"));
                }
            };
        }
Exemplo n.º 3
0
        public JsonRpcModule(IJsonSerializer jsonSerializer,
            IJsonRpcRequestParser requestParser,
            IRequestHandler requestHandler)
        {
            Post["/jsonrpc"] = _ =>
            {
                this.RequiresAuthentication();

                using (var ms = new MemoryStream())
                {
                    Request.Body.CopyTo(ms);

                    var json = Encoding.UTF8.GetString(ms.ToArray());
                    var request = requestParser.Parse(json);
                    var response = requestHandler.Handle(request);

                    return Response.AsText(jsonSerializer.SerializeObject(response), "application/json");
                }
            };
        }
Exemplo n.º 4
0
 public IntegrationTests()
 {
     classUnderTest = new JsonRpcRequestParser(new ApolloJsonSerializer());
 }