索引5的特定于方案的预期部分:空值:

问题描述 投票:0回答:1

当尝试使用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')
rest groovy spock
1个回答
0
投票

从中删除冒号

def SERVER_PORT = "8082"

或从中删除冒号>

def client = new RESTClient("$SERVER_URL$SERVER_PORT")

您在端口前有太多冒号

© www.soinside.com 2019 - 2024. All rights reserved.