changeset 1354:2449ca95dc1e

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 25 Mar 2019 16:55:17 -0600
parents 8d95711f6615
children b84f60ebe196
files src/luan/modules/url/LuanUrl.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
diff -r 8d95711f6615 -r 2449ca95dc1e src/luan/modules/url/LuanUrl.java
--- a/src/luan/modules/url/LuanUrl.java	Wed Mar 20 17:03:29 2019 -0600
+++ b/src/luan/modules/url/LuanUrl.java	Mon Mar 25 16:55:17 2019 -0600
@@ -30,7 +30,7 @@
 
 	private static enum Method { GET, POST, DELETE }
 
-	private URL url;
+	public final URL url;
 	private Method method = Method.GET;
 	private final Map<String,Object> headers = new HashMap<String,Object>();
 	private String content = "";
@@ -40,7 +40,6 @@
 	private String authPassword = null;
 
 	public LuanUrl(URL url,LuanTable options) throws LuanException {
-		this.url = url;
 		if( options != null ) {
 			Map map = options.asMap();
 			String methodStr = getString(map,"method");
@@ -131,7 +130,7 @@
 				if( this.method==Method.POST ) {
 					content = sb.toString();
 				} else {
-					String urlS = this.url.toString();
+					String urlS = url.toString();
 					if( urlS.indexOf('?') == -1 ) {
 						urlS += '?';
 					} else {
@@ -139,7 +138,7 @@
 					}
 					urlS += sb;
 					try {
-						this.url = new URL(urlS);
+						url = new URL(urlS);
 					} catch(IOException e) {
 						throw new RuntimeException(e);
 					}
@@ -151,6 +150,7 @@
 			if( !map.isEmpty() )
 				throw new LuanException( "unrecognized options: "+map );
 		}
+		this.url = url;
 	}
 
 	private static void and(StringBuilder sb) {