Calling a local endpoint in scala

168 Views Asked by At

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?

1

There are 1 best solutions below

3
Tomer Shetah On BEST ANSWER

You need to add a scheme:

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