本文整理汇总了C#中HttpVerbs类的典型用法代码示例。如果您正苦于以下问题:C# HttpVerbs类的具体用法?C# HttpVerbs怎么用?C# HttpVerbs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpVerbs类属于命名空间,在下文中一共展示了HttpVerbs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddEntryToList
private static void AddEntryToList(HttpVerbs verbs, HttpVerbs match, List<string> verbList, string entryText)
{
if ((verbs & match) != 0)
{
verbList.Add(entryText);
}
}
示例2: DynamicApiActionInfo
/// <summary>
/// 初始化一个新的<see cref="DynamicApiActionInfo"/>实例
/// </summary>
/// <param name="actionName">Action 名称</param>
/// <param name="verb">HTTP Verb</param>
/// <param name="method">一个方法信息,随着 Action 的调用而调用</param>
/// <param name="filters">用于 Controller Action 的动态筛选器</param>
public DynamicApiActionInfo(string actionName, HttpVerbs verb, MethodInfo method, IFilter[] filters = null)
{
ActionName = actionName;
Verb = verb;
Method = method;
Filters = filters ?? new IFilter[] { };
}
示例3: CheckForBindingInPutOperations
protected static void CheckForBindingInPutOperations(HttpVerbs requestVerb)
{
if (requestVerb == HttpVerbs.PUT)
{
throw DataServiceException.CreateBadRequestError(System.Data.Services.Strings.BadRequest_CannotUpdateRelatedEntitiesInPut);
}
}
示例4: RESTFulActionConstraint
/// <summary>
/// Initializes a new instance of the <see cref="RESTFulActionConstraint"/> class.
/// </summary>
/// <param name="httpVerb">The HTTP verb.</param>
/// <param name="requiresId">if set to <c>true</c> [requires id].</param>
public RESTFulActionConstraint(HttpVerbs httpVerb, bool requiresId)
{
HttpVerbs = httpVerb;
RequiresId = requiresId;
verbs = ConvertToStringList(HttpVerbs);
}
示例5: Users
public PartialViewResult Users(HttpVerbs? method, int? page, int? sizePage)
{
var model = new ModelTestApiResult();
// if 'Get'
if(method == HttpVerbs.Get)
{
// start the timer
var timer = Stopwatch.StartNew();
// perform the call
List<UserV2> users;
var response = LicenceManager.TryListUsers(out users);
// stop the timer
timer.Stop();
model.ElapsedMilliseconds = timer.ElapsedMilliseconds;
// get the content
model.Users = users;
// get the code
model.ResponseBody = response.GetBodyAsString();
// get the exception message
model.Message = response.MessageError;
// get the status code
model.StatusCode = response.StatusHttp;
}
// if method is not supported
else
model.Message = "Method not supported";
return this.PartialView("Result", model);
}
示例6: GetRestsharpMethod
private Method GetRestsharpMethod(HttpVerbs method)
{
Method result;
switch (method)
{
case HttpVerbs.Get:
result = Method.GET;
break;
case HttpVerbs.Post:
result = Method.POST;
break;
case HttpVerbs.Put:
result = Method.PUT;
break;
case HttpVerbs.Patch:
result = Method.PATCH;
break;
case HttpVerbs.Delete:
result = Method.DELETE;
break;
case HttpVerbs.Head:
result = Method.HEAD;
break;
default:
result = Method.GET;
break;
}
return result;
}
示例7: RunPostExecutionFilters
private static void RunPostExecutionFilters(IAction action, HttpVerbs httpVerb) {
var filters = GetFilters(action, httpVerb);
filters.ForEach(x => {
x.Context = action.Context;
x.AfterExecute();
});
}
示例8: ValidateAntiForgeryTokenWrapperAttribute
public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs)
{
this._verbs = new AcceptVerbsAttribute(verbs);
this._validator = new ValidateAntiForgeryTokenAttribute()
{
Salt = Consts.AntiForgeryToken
};
}
示例9: ApiDocumentationAttribute
public ApiDocumentationAttribute( String url, String description = "", Type returnType = null, HttpVerbs requestType = HttpVerbs.Get, Type formBody = null )
{
Url = url;
Description = description;
ReturnType = returnType;
RequestType = requestType;
FormBody = formBody;
}
示例10: ClientPreference
/// <summary>
/// Initializes a new instance of the <see cref="ClientPreference"/> class.
/// </summary>
/// <param name="requestDescription">The request description.</param>
/// <param name="verb">The request verb.</param>
/// <param name="requestMessage">The request message.</param>
/// <param name="effectiveMaxResponseVersion">The effective max response version for the request, which is the min of MDSV and MPV.</param>
public ClientPreference(RequestDescription requestDescription, HttpVerbs verb, IODataRequestMessage requestMessage, Version effectiveMaxResponseVersion)
: this(InterpretClientPreference(requestDescription, verb, requestMessage))
{
if (effectiveMaxResponseVersion >= VersionUtil.Version4Dot0)
{
this.annotationFilter = requestMessage.PreferHeader().AnnotationFilter;
}
}
示例11: ValidateAntiForgeryTokenWrapperAttribute
public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs, string salt)
{
this._verbs = new AcceptVerbsAttribute(verbs);
this._validator = new ValidateAntiForgeryTokenAttribute()
{
Salt = salt
};
}
示例12: DoRequest
public string DoRequest(string query, HttpVerbs method, Action<Stream> data, string contenttype)
{
Stream stream = DoDataRequest(query, method, data, contenttype);
System.IO.StreamReader sr = new StreamReader(stream, Encoding.UTF8);
return sr.ReadToEnd();
}
示例13: BuildForm
public static HtmlTag Form
(this HtmlHelper html, string actionName, string controllerName, RouteValueDictionary routeValues,
HttpVerbs method)
{
var action = UrlHelper.GenerateUrl
(null, actionName, controllerName, routeValues, html.RouteCollection,
html.ViewContext.RequestContext, true);
return BuildForm(action, method);
}
示例14: CustomValidateAntiForgeryTokenAttribute
/// <summary>
/// Initializes a new instance of the <see cref="CustomValidateAntiForgeryTokenAttribute"/> class.
/// </summary>
/// <param name="verbs">The verbs.</param>
/// <param name="salt">The salt.</param>
public CustomValidateAntiForgeryTokenAttribute(HttpVerbs verbs, string salt)
{
Verbs = verbs;
Salt = salt;
AcceptVerbsAttribute = new AcceptVerbsAttribute(Verbs);
Validator = new ValidateAntiForgeryTokenAttribute
{
Salt = Salt
};
}
示例15: EnumToArray
internal static string[] EnumToArray(HttpVerbs verbs) {
List<string> verbList = new List<string>();
AddEntryToList(verbs, HttpVerbs.Get, verbList, "GET");
AddEntryToList(verbs, HttpVerbs.Post, verbList, "POST");
AddEntryToList(verbs, HttpVerbs.Put, verbList, "PUT");
AddEntryToList(verbs, HttpVerbs.Delete, verbList, "DELETE");
AddEntryToList(verbs, HttpVerbs.Head, verbList, "HEAD");
return verbList.ToArray();
}