使用 RequestSpecBuilder 创建 GET 请求
create a GET request with RequestSpecBuilder
我试过查询参数和路径参数,但它给出了错误 Undefined path parameters are: job_id
我猜这是因为 URI 以错误的格式结尾。
builder.addQueryParams(queryParams);
return getAPIResponse();
预期格式为 https://api.themoviedb.org/4/list/{job_id}
实际格式为 https://api.themoviedb.org/4/list/?job_id={job_id}
如何构建预期格式的 URI?
预期的是路径参数 https://api.themoviedb.org/4/list/{job_id}
但您将其添加为查询参数 addQueryParams
RequestSpecBuilder builder = new RequestSpecBuilder();
builder.addPathParam("job_id", "abc");
RequestSpecification requestSpec = builder.build();
given().log().all().spec(requestSpec).when().get("https://api.themoviedb.org/4/list/{job_id}");
我试过查询参数和路径参数,但它给出了错误 Undefined path parameters are: job_id
我猜这是因为 URI 以错误的格式结尾。
builder.addQueryParams(queryParams);
return getAPIResponse();
预期格式为 https://api.themoviedb.org/4/list/{job_id}
实际格式为 https://api.themoviedb.org/4/list/?job_id={job_id}
如何构建预期格式的 URI?
预期的是路径参数 https://api.themoviedb.org/4/list/{job_id}
但您将其添加为查询参数 addQueryParams
RequestSpecBuilder builder = new RequestSpecBuilder();
builder.addPathParam("job_id", "abc");
RequestSpecification requestSpec = builder.build();
given().log().all().spec(requestSpec).when().get("https://api.themoviedb.org/4/list/{job_id}");