Browse Source

[js] use `js.node.url.URL` in HttpNodeJs to parse urls (closes #9664)

Aleksandr Kuzmenko 4 years ago
parent
commit
c83670323b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      std/haxe/http/HttpNodeJs.hx

+ 2 - 2
std/haxe/http/HttpNodeJs.hx

@@ -47,10 +47,10 @@ class HttpNodeJs extends haxe.http.HttpBase {
 	public override function request(?post:Bool) {
 		responseAsString = null;
 		responseBytes = null;
-		var parsedUrl = js.node.Url.parse(url);
+		var parsedUrl = new js.node.url.URL(url);
 		var secure = (parsedUrl.protocol == "https:");
 		var host = parsedUrl.hostname;
-		var path = parsedUrl.path;
+		var path = parsedUrl.pathname;
 		var port = if (parsedUrl.port != null) Std.parseInt(parsedUrl.port) else (secure ? 443 : 80);
 		var h:Dynamic = {};
 		for (i in headers) {