vesheff / AspNetCore.Mvc.HttpActionResults

A collection of HTTP status code action results and controller extension methods for ASP.NET Core MVC projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AspNetCore.Mvc.HttpActionResults  AspNetCore.Mvc.HttpActionResults - HTTP
  status code results for ASP.NET Core MVC
 

====================================

AspNetCore.Mvc.HttpActionResults is a collection of HTTP status code action results and controller extension methods for ASP.NET Core MVC. Implemented as per the HTTP status code specifications.

Installation

You can install this library using NuGet into your project (or reference it directly in your project.json file). There is no need to add any namespace usings since the package uses the default ones to add extension methods.

Install-Package AspNetCore.Mvc.HttpActionResults

This package will include all available action results and extension methods in your test project. If you prefer, you can be more specific by including only some of the packages.

Action results packages:

  • AspNetCore.Mvc.HttpActionResults.Informational - Contains Informational (1xx) HTTP action results
  • AspNetCore.Mvc.HttpActionResults.Success - Contains Success (2xx) HTTP action results
  • AspNetCore.Mvc.HttpActionResults.Redirection - Contains Redirection (3xx) HTTP action results
  • AspNetCore.Mvc.HttpActionResults.ClientError - Contains Client Error (4xx) HTTP action results
  • AspNetCore.Mvc.HttpActionResults.ServerError - Contains Server Error (5xx) HTTP action results

ControllerBase extension methods packages:

  • AspNetCore.Mvc.HttpActionResults.Informational.Extensions - Contains Informational (1xx) HTTP extension methods
  • AspNetCore.Mvc.HttpActionResults.Success.Extensions - Contains Success (2xx) HTTP extension methods
  • AspNetCore.Mvc.HttpActionResults.Redirection.Extensions - Contains Redirection (3xx) HTTP extension methods
  • AspNetCore.Mvc.HttpActionResults.ClientError.Extensions - Contains Client Error (4xx) HTTP extension methods
  • AspNetCore.Mvc.HttpActionResults.ServerError.Extensions - Contains Server Error (5xx) HTTP extension methods

How to use

After the downloading is complete, you can use the provided action results and controller extension methods.

Available action results:

// 100 Continue
ContinueResult

// 101 Switching Protocols
SwitchingProtocolsResult

// 202 Accepted
AcceptedResult
AcceptedObjectResult

// 303 See Other
SeeOtherResult
SeeOtherObjectResult

// 304 Not Modified
NotModifiedResult

// 405 Method Not Allowed
MethodNotAllowedResult

// 408 Request Timeout
RequestTimeoutResult

// 411 Length Required
LengthRequiredResult

// 412 Precondition Failed
PreconditionFailedResult
PreconditionFailedObjectResult

// 501 Not Implemented
NotImplementedResult

// 502 Bad Gateway
BadGatewayResult

// 504 Gateway Timeout
GatewayTimeoutResult

Available ControllerBase extension methods:

// returns 100 Continue
controller.Continue();

// returns 101 Switching Protocols
controller.SwitchingProtocols(upgradeValue);

// returns 202 Accepted
controller.Accepted();

// returns 202 Accepted with Location header
controller.Accepted(someUri);

// returns 202 Accepted with formatted value
controller.Accepted(someObject);

// returns 202 Accepted with Location header and formatted value
controller.Accepted(someUri, someObject);

// returns 303 See Other
controller.SeeOther();

// returns 303 See Other with Location header
controller.SeeOther(someUri);

// returns 303 See Other with formatted value
controller.SeeOther(someObject);

// returns 303 See Other with Location header and formatted value
controller.SeeOther(someUri, someObject);

// returns 304 Not Modified
controller.NotModified();

// returns 405 Method Not Allowed
controller.MethodNotAllowed();

// returns 408 Request Timeout
controller.RequestTimeout();

// returns 411 Length Required
controller.LengthRequired();

// returns 412 Precondition Failed
controller.PreconditionFailed();

// returns 412 Precondition Failed with formatted value
controller.PreconditionFailed(someObject);

// returns 415 Unsupported Media Type
controller.UnsupportedMediaType();

// returns 501 Not Implemented
controller.NotImplemented();

// returns 502 Bad Gateway
controller.BadGateway();

// returns 504 Gateway Timeout
controller.GatewayTimeout();

License

Code by Ivaylo Kenov. Copyright 2016 Ivaylo Kenov.

This package has MIT license. Refer to the LICENSE for detailed information.

Any questions, comments or additions?

If you have a feature request or bug report, leave an issue on the issues page or send a pull request. For general questions and comments, use the StackOverflow forum.

About

A collection of HTTP status code action results and controller extension methods for ASP.NET Core MVC projects.

License:MIT License


Languages

Language:C# 100.0%