瀏覽代碼

[std] apply some wrapping to `HttpMethod` and `Scheme` docs

+ some markdown formatting

One of these lines was almost 1000 characters long...
[skip ci]
Jens Fischer 6 年之前
父節點
當前提交
105fd51e97
共有 3 個文件被更改,包括 59 次插入23 次删除
  1. 43 10
      std/haxe/http/HttpMethod.hx
  2. 2 3
      std/haxe/io/Mime.hx
  3. 14 10
      std/haxe/io/Scheme.hx

+ 43 - 10
std/haxe/http/HttpMethod.hx

@@ -1,51 +1,84 @@
 package haxe.http;
 
 /**
-	HTTP defines methods (sometimes referred to as verbs) to indicate the desired action to be performed on the identified resource. What this resource represents, whether pre-existing data or data that is generated dynamically, depends on the implementation of the server. Often, the resource corresponds to a file or the output of an executable residing on the server. The HTTP/1.0 specification[11] defined the GET, POST and HEAD methods and the HTTP/1.1 specification[12] added 5 new methods: OPTIONS, PUT, DELETE, TRACE and CONNECT. By being specified in these documents their semantics are well known and can be depended upon. Any client can use any method and the server can be configured to support any combination of methods. If a method is unknown to an intermediate it will be treated as an unsafe and non-idempotent method. There is no limit to the number of methods that can be defined and this allows for future methods to be specified without breaking existing infrastructure.
+	HTTP defines methods (sometimes referred to as _verbs_) to indicate the desired action to be
+	performed on the identified resource. What this resource represents, whether pre-existing data
+	or data that is generated dynamically, depends on the implementation of the server.
+
+	Often, the resource corresponds to a file or the output of an executable residing on the server.
+	The HTTP/1.0 specification defined the `GET`, `POST` and `HEAD` methods and the HTTP/1.1
+	specification added 5 new methods: `OPTIONS`, `PUT`, `DELETE`, `TRACE` and `CONNECT`.
+
+	By being specified in these documents their semantics are well known and can be depended upon.
+	Any client can use any method and the server can be configured to support any combination of methods.
+	If a method is unknown to an intermediate it will be treated as an unsafe and non-idempotent method.
+	There is no limit to the number of methods that can be defined and this allows for future methods to
+	be specified without breaking existing infrastructure.
 **/
 enum abstract HttpMethod(String) from String to String {
 	/**
-		The POST method requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI. The data POSTed might be, for example, an annotation for existing resources; a message for a bulletin board, newsgroup, mailing list, or comment thread; a block of data that is the result of submitting a web form to a data-handling process; or an item to add to a database
+		The `POST` method requests that the server accept the entity enclosed in the request as
+		a new subordinate of the web resource identified by the URI.
+		
+		The data `POST`ed might be, for example, an annotation for existing resources;
+		a message for a bulletin board, newsgroup, mailing list, or comment thread;
+		a block of data that is the result of submitting a web form to a data-handling process;
+		or an item to add to a database.
 	**/
 	var Post = 'POST';
 
 	/**
-		The GET method requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect. (This is also true of some other HTTP methods.)[1] The W3C has published guidance principles on this distinction, saying, "Web application design should be informed by the above principles, but also by the relevant limitations."[13] See safe methods below.
+		The `GET` method requests a representation of the specified resource.
+
+		Requests using `GET` should only retrieve data and should have no other effect.
+		(This is also true of some other HTTP methods.) The W3C has published guidance
+		principles on this distinction, saying, _"Web application design should be informed
+		by the above principles, but also by the relevant limitations."_
+
+		See safe methods below.
 	**/
 	var Get = 'GET';
 
 	/**
-		The HEAD method asks for a response identical to that of a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.
+		The `HEAD` method asks for a response identical to that of a `GET` request,
+		but without the response body. This is useful for retrieving meta-information
+		written in response headers, without having to transport the entire content.
 	**/
 	var Head = 'HEAD';
 
 	/**
-		The PUT method requests that the enclosed entity be stored under the supplied URI. If the URI refers to an already existing resource, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI
+		The `PUT` method requests that the enclosed entity be stored under the supplied URI.
+		If the URI refers to an already existing resource, it is modified; if the URI does
+		not point to an existing resource, then the server can create the resource with that URI.
 	**/
 	var Put = 'PUT';
 
 	/**
-		The DELETE method deletes the specified resource.
+		The `DELETE` method deletes the specified resource.
 	**/
 	var Delete = 'DELETE';
 
 	/**
-		The TRACE method echoes the received request so that a client can see what (if any) changes or additions have been made by intermediate servers
+		The `TRACE` method echoes the received request so that a client can see
+		what (if any) changes or additions have been made by intermediate servers.
 	**/
 	var Trace = 'TRACE';
 
 	/**
-		The OPTIONS method returns the HTTP methods that the server supports for the specified URL. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource.
+		The `OPTIONS` method returns the HTTP methods that the server supports for the
+		specified URL. This can be used to check the functionality of a web server by
+		requesting `*` instead of a specific resource.
 	**/
 	var Options = 'OPTIONS';
 
 	/**
-		The CONNECT method converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.
+		The `CONNECT` method converts the request connection to a transparent TCP/IP tunnel,
+		usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.
 	**/
 	var Connect = 'CONNECT';
 
 	/**
-		The PATCH method applies partial modifications to a resource.
+		The `PATCH` method applies partial modifications to a resource.
 	**/
 	var Patch = 'PATCH';
 }

+ 2 - 3
std/haxe/io/Mime.hx

@@ -1,10 +1,9 @@
 package haxe.io;
 
 /**
-    Html MimeType Enum
+    HTML MimeType Enum
     @see http://www.sitepoint.com/web-foundations/mime-types-complete-list/
- **/
-
+**/
 enum abstract Mime(String) from String to String {
     var XWorldX3dmf = 'x-world/x-3dmf';
     var ApplicationOctetStream = 'application/octet-stream';

+ 14 - 10
std/haxe/io/Scheme.hx

@@ -1,14 +1,18 @@
 package haxe.io;
-/**
-    The scheme consists of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. It is followed by a colon (:).
-**/
-enum abstract Scheme(String) from String to String  {
 
-    var Http = 'http';
-    var Https = 'https';
-    var Ftp = 'ftp';
-    var MailTo = 'mailto';
-    var File = 'file';
-    var Data = 'data';
+/**
+	A scheme consists of a sequence of characters beginning with a letter and followed
+	by any combination of letters, digits, plus (`+`, period (`.`), or hyphen (`-`).
 
+	Although schemes are case-insensitive, the canonical form is lowercase
+	and documents that specify schemes must do so with lowercase letters.
+	It is followed by a colon (`:`).
+**/
+enum abstract Scheme(String) from String to String {
+	var Http = 'http';
+	var Https = 'https';
+	var Ftp = 'ftp';
+	var MailTo = 'mailto';
+	var File = 'file';
+	var Data = 'data';
 }