代码之家  ›  专栏  ›  技术社区  ›  vikramvi

如何传递curl--用户通过rest assured

  •  0
  • vikramvi  · 技术社区  · 8 年前

    下面是卷曲

    curl --user name:passwoed -k -X POST \
      https://test_url/oauth/token \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d grant_type=client_credentials
    

    我试过低于400

    given().relaxedHTTPSValidation().
         auth().basic("name", "password").
    when().
         post("https://test_url/oauth/token").
    then().
         statusCode(200)
    
    1 回复  |  直到 8 年前
        1
  •  0
  •   vikramvi    8 年前

    下面是解决方案 注意,我之前没有传递数据

     given().relaxedHTTPSValidation().
           auth().basic("name", "password").
           param("grant_type","client_credentials").
     when().
           post("https://test_url/oauth/token").
     then().
           statusCode(200);