当尝试使用Spock框架获取HTTP get响应时,出现以下异常。
java.net.URISyntaxException: Expected scheme-specific part at index 5: null:
def SERVER_URL = "http://localhost"
def SERVER_PORT = ":8082"
def USERNAME = "[email protected]"
def PASSWORD = "123456"
def client = new RESTClient("$SERVER_URL:$SERVER_PORT")
def 'should return 200 code when used valid credentials'() {
when: 'login with valid credentials'
client.headers['Authorization'] = "Basic ${"$USERNAME:$PASSWORD".bytes.encodeBase64()}"
def response = client.get(path:'/artifactory/ui/auth/screen/footer')
从中删除冒号
def SERVER_PORT = "8082"
或从中删除冒号>
def client = new RESTClient("$SERVER_URL$SERVER_PORT")
您在端口前有太多冒号