0

basically I have to call a localhost mock server, at this location:

"127.0.0.1:8000/redfish/v1/EventService"

The problem is: fromURL wants a protocol (localhost doesn't have). fromFile wants a directory or a URI. Injecting a URI (created this way:

var uri: URI = new URI("127.0.0.1:8000/redfish/v1/EventService")

throws an exception:

java.net.URISyntaxException: Illegal character in scheme name at index 0:

What method should I use to call a local endpoint?

Tomer Shetah
  • 8,413
  • 7
  • 27
  • 35

2 Answers2

2

You need to add a scheme:

val uri: URI = new URI("http://127.0.0.1:8000/redfish/v1/EventService")
Tomer Shetah
  • 8,413
  • 7
  • 27
  • 35
0

thanks to Tomer, i solved by making this:
var url: URL = new URL(http://127.0.0.1:8000/redfish/v1/EventService)
var result: String = fromURL(url).mkString

So yeah, it needs http:// even in local directories.

Feel free to use fromURL()