public Server(int port) { _uriPrefix = String.Format("http://localhost:{0}/", port); _baseUri = string.Format("http://localhost:{0}/", port); BodyParser = BodyParsers.DefaultBodyParser(); BodyWriter = BodyWriters.DefaultBodyWriter(); ParamsParser = new UrlParamsParser(); _anyRequestHandler = new HttpHandler(this); Start(); }
public Server(int port) { Port = port; _uriPrefix = $"http://localhost:{port}/"; BaseUri = $"http://localhost:{port}/"; BodyParser = BodyParsers.DefaultBodyParser(); BodyWriter = BodyWriters.DefaultBodyWriter(); ParamsParser = new UrlParamsParser(); _anyRequestHandler = new HttpHandler(this); Start(); }
public static BodyParsers DefaultBodyParser() { var parsers = new BodyParsers(); parsers.RegisterBodyParser(stream => stream); parsers.RegisterBodyParser(stream => { using (var streamReader = new StreamReader(stream)) { return(streamReader.ReadToEnd()); } }); return(parsers); }