Browse Source

Default content-type for js/post request

Pascal Peridont 19 years ago
parent
commit
9dad5a3f8e
1 changed files with 4 additions and 1 deletions
  1. 4 1
      std/haxe/Http.hx

+ 4 - 1
std/haxe/Http.hx

@@ -87,6 +87,9 @@ class Http {
 			onError(e.toString());
 			return;
 		}
+		if( headers.get("Content-Type") == null && post )
+			r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
+			
 		for( h in headers.keys() )
 			r.setRequestHeader(h,headers.get(h));
 		r.send(uri);
@@ -235,4 +238,4 @@ class Http {
 	public function onStatus( status : Int ) {
 	}
 
-}
+}