Explorar el Código

added custom method

Nicolas Cannasse hace 18 años
padre
commit
0f94072fbf
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      std/haxe/Http.hx

+ 5 - 2
std/haxe/Http.hx

@@ -247,7 +247,7 @@ class Http {
 		this.file = { param : argname, filename : filename, io : file, size : size };
 	}
 
-	public function customRequest( post : Bool, api : neko.io.Output, ?sock : AbstractSocket  ) {
+	public function customRequest( post : Bool, api : neko.io.Output, ?sock : AbstractSocket, ?method : String  ) {
 		var url_regexp = ~/^(http:\/\/)?([a-zA-Z\.0-9-]+)(:[0-9]+)?(.*)$/;
 		if( !url_regexp.match(url) ) {
 			onError("Invalid URL");
@@ -306,7 +306,10 @@ class Http {
 		}
 
 		var b = new StringBuf();
-		if( post )
+		if( method != null ) {
+			b.add(method);
+			b.add(" ");
+		} else if( post )
 			b.add("POST ");
 		else
 			b.add("GET ");