javascalaurimockups

Calling a local endpoint in scala


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?


Solution

  • You need to add a scheme:

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