Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

[refactoring] Cleanup constructor #274

Merged
merged 1 commit into from
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,13 @@ class URLTest extends AnyFunSpec {
myURL.search = "abc=xyz"
assert(myURL.href === "https://example.org/abc?abc=xyz")
}

it("should support base URL string") {
val url1 = new URL("/abc?123", "https://example.org")
assert(url1.href === "https://example.org/abc?123")

val url2 = new URL("/abc?123", new URL("https://example.org"))
assert(url2.href === "https://example.org/abc?123")
}
}
}
13 changes: 4 additions & 9 deletions app/nodejs-v14/src/main/scala/io/scalajs/nodejs/url/URL.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.|

/**
* This module has utilities for URL resolution and parsing. Call require('url') to use it.
* @param input The input URL to parse
* @param base The base URL to resolve against if the input is not absolute.
* @see https://nodejs.org/api/url.html
*/
@js.native
@JSImport("url", "URL")
class URL(input: String, base: String) extends js.Object {
def this(input: String, base: URL) = this(input, "")
def this(input: String) = this(input, "")
class URL protected () extends js.Object {
def this(input: String, base: String) = this()
def this(input: String, base: URL) = this()
def this(input: String) = this()

/**
* The auth property is the username and password portion of the URL, also referred to as "userinfo".
Expand Down