public void init(HttpContext ctx) { this.ctx = ctx; this.api = new JDApiBase(); this.api.env = this; this._GET = new NameValueCollection(ctx.Request.QueryString); this._POST = new NameValueCollection(ctx.Request.Form); this.isTestMode = int.Parse(ConfigurationManager.AppSettings["P_TEST_MODE"] ?? "0") != 0; this.debugLevel = int.Parse(ConfigurationManager.AppSettings["P_DEBUG"] ?? "0"); this.appName = api.param("_app", "user", "G") as string; this.appType = Regex.Replace(this.appName, @"(\d+|-\w+)$", ""); if (ctx.Request.ContentType != null && ctx.Request.ContentType.IndexOf("/json") > 0) { var rd = new StreamReader(ctx.Request.InputStream); var jsonStr = rd.ReadToEnd(); this.JsonContent = this.api.jsonDecode(jsonStr); if (JsonContent is IDictionary <string, object> ) { var dict = (IDictionary <string, object>)JsonContent; foreach (var kv in dict) { if (!(kv.Value is IList || kv.Value is IDictionary)) { this._POST[kv.Key] = kv.Value.ToString(); } } } } if (this.isTestMode) { api.header("X-Daca-Test-Mode", "1"); } // TODO: X-Daca-Mock-Mode, X-Daca-Server-Rev }