public HttpResponseContext Delete(HttpRequestContext request) { return(GetResponse(request, "DELETE")); }
public HttpResponseContext Patch(HttpRequestContext request) { return(GetResponse(request, "PATCH")); }
public HttpResponseContext Post(HttpRequestContext request, string output = null) { return(GetResponse(request, "POST", output)); }
public HttpResponseContext Put(HttpRequestContext request) { return(GetResponse(request, "PUT")); }
private static void SetRequestHeaders(HttpRequestContext request, HttpWebRequest webRequest) { foreach (var item in request.Headers.Select(x => x.GetRawValue() as KeyAndValueImpl)) { System.Diagnostics.Trace.Assert(item != null); var key = item.Key.AsString(); var value = item.Value.AsString(); switch (key.ToUpperInvariant()) { case "CONTENT-TYPE": webRequest.ContentType = value; break; case "CONTENT-LENGTH": try { webRequest.ContentLength = Int32.Parse(value); } catch (FormatException) { throw new RuntimeException("Заголовок Content-Length задан неправильно"); } break; case "ACCEPT": webRequest.Accept = value; break; case "EXPECT": webRequest.Expect = value; break; case "TRANSFER-ENCODING": webRequest.TransferEncoding = value; break; case "CONNECTION": if (value.Equals("KEEP-ALIVE", StringComparison.OrdinalIgnoreCase)) { webRequest.KeepAlive = true; } else if (value.Equals("CLOSE", StringComparison.OrdinalIgnoreCase)) { webRequest.KeepAlive = false; } else { webRequest.Connection = value; } break; case "DATE": try { webRequest.Date = DateTime.Parse(value); } catch (FormatException) { throw new RuntimeException("Заголовок Date задан неправильно"); } break; case "HOST": webRequest.Host = value; break; case "IF-MODIFIED-SINCE": try { webRequest.IfModifiedSince = DateTime.Parse(value); } catch (FormatException) { throw new RuntimeException("Заголовок If-Modified-Since задан неправильно"); } break; case "RANGE": throw new NotImplementedException(); case "REFERER": webRequest.Referer = value; break; case "USER-AGENT": webRequest.UserAgent = value; break; case "PROXY-CONNECTION": throw new NotImplementedException(); default: webRequest.Headers.Set(key, value); break; } } }
public HttpResponseContext Patch(string method, HttpRequestContext request, string output = null) { return(GetResponse(request, method, output)); }
public HttpResponseContext Head(HttpRequestContext request) { return(GetResponse(request, "HEAD")); }