private void DoGet(HttpRequest request, HttpResponse response) { string format = request.QueryString["format"]; string url = request.Url.GetComponents(UriComponents.Scheme | UriComponents.Host | UriComponents.Port | UriComponents.Path, UriFormat.Unescaped); var apiBuilder = new DirectApiBuilder(_metadata); if (string.Equals(format, "json", StringComparison.InvariantCultureIgnoreCase)) { response.ContentType = "application/json"; response.Write(apiBuilder.BuildJson(url)); } else { response.ContentType = "text/javascript"; response.Write(apiBuilder.BuildJavascript(url)); } }
private void DoGet(HttpRequest request, HttpResponse response) { string format = request.QueryString["format"]; string url = request.Url.GetComponents(UriComponents.Scheme | UriComponents.Host | UriComponents.Port | UriComponents.Path, UriFormat.Unescaped); var apiBuilder = new DirectApiBuilder(_metadata); if(string.Equals(format, "json", StringComparison.InvariantCultureIgnoreCase)) { response.ContentType = "application/json"; response.Write(apiBuilder.BuildJson(url)); } else { response.ContentType = "text/javascript"; response.Write(apiBuilder.BuildJavascript(url)); } }
private void DoGet(HttpRequest request, HttpResponse response) { string ns = request.QueryString["ns"]; string format = request.QueryString["format"]; string url = request.Url.GetComponents(UriComponents.Scheme | UriComponents.Host | UriComponents.Port | UriComponents.Path, UriFormat.Unescaped); DirectApiBuilder apiBuilder = new DirectApiBuilder(_metadata); if (format == "json") { response.ContentType = "application/json"; response.Write(apiBuilder.BuildApiDescriptor(ns, ns, url)); } else { response.ContentType = "text/javascript"; response.Write(apiBuilder.BuildApi(ns, url)); } }