示例#1
0
		public static void SendSuccessResult(ResultDelegate result, ResponseWrapper response)
		{
			result(
				// Status:
				response.StatusCode + " " + response.StatusDescription,

				// Headers:
				response.Headers.Set("Content-Type",response.ContentType ?? ""),

				// Output
				(write, flush, end, cancel) => {
					var bytes = response.Buffer.ToArray();
					if (bytes.LongLength > 0)
					{
						write(new ArraySegment<byte>(bytes));
					}
					end(null);
				});
		}
		public ContextWrapper(IDictionary<string, object> env)
		{
			this.env = env;
			reponseWrapper = new ResponseWrapper();
			requestWrapper = new RequestWrapper(env);
		}