HTTPMethods.cs 5.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. namespace BestHTTP
  2. {
  3. /// <summary>
  4. /// Some supported methods described in the rfc: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
  5. /// </summary>
  6. public enum HTTPMethods : byte
  7. {
  8. /// <summary>
  9. /// The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.
  10. /// If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the
  11. /// entity in the response and not the source text of the process, unless that text happens to be the output of the process.
  12. /// </summary>
  13. Get,
  14. /// <summary>
  15. /// The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response.
  16. /// The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request.
  17. /// This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself.
  18. /// This method is often used for testing hypertext links for validity, accessibility, and recent modification.
  19. /// </summary>
  20. Head,
  21. /// <summary>
  22. /// The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.
  23. /// POST is designed to allow a uniform method to cover the following functions:
  24. /// <list type="bullet">
  25. /// <item><description>Annotation of existing resources;</description></item>
  26. /// <item><description>Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;</description></item>
  27. /// <item><description>Providing a block of data, such as the result of submitting a form, to a data-handling process;</description></item>
  28. /// <item><description>Extending a database through an append operation.</description></item>
  29. /// </list>
  30. /// The actual function performed by the POST method is determined by the server and is usually dependent on the Request-URI.
  31. /// The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it,
  32. /// a news article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a database.
  33. /// The action performed by the POST method might not result in a resource that can be identified by a URI. In this case,
  34. /// either 200 (OK) or 204 (No Content) is the appropriate response status, depending on whether or not the response includes an entity that describes the result.
  35. /// </summary>
  36. Post,
  37. /// <summary>
  38. /// The PUT method requests that the enclosed entity be stored under the supplied Request-URI.
  39. /// If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server.
  40. /// If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent,
  41. /// the origin server can create the resource with that URI. If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response.
  42. /// If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request.
  43. /// If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem.
  44. /// The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a 501 (Not Implemented) response in such cases.
  45. /// </summary>
  46. Put,
  47. /// <summary>
  48. /// The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server.
  49. /// The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully.
  50. /// However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.
  51. /// A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content)
  52. /// if the action has been enacted but the response does not include an entity.
  53. /// </summary>
  54. Delete,
  55. /// <summary>
  56. /// http://tools.ietf.org/html/rfc5789
  57. /// The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI.
  58. /// The set of changes is represented in a format called a "patchdocument" identified by a media type. If the Request-URI does not point to an existing resource,
  59. /// the server MAY create a new resource, depending on the patch document type (whether it can logically modify a null resource) and permissions, etc.
  60. /// </summary>
  61. Patch,
  62. /// <summary>
  63. /// The HTTP methods PATCH can be used to update partial resources. For instance, when you only need to update one field of the resource, PUTting a complete resource representation might be cumbersome and utilizes more bandwidth.
  64. /// <seealso href="http://restcookbook.com/HTTP%20Methods/patch/"/>
  65. /// </summary>
  66. Merge,
  67. Options
  68. }
  69. }