我正在尝试使用 RESTful API 实现测试,但在尝试调用 get 操作时遇到了空指针异常。授权是一个自定义方案,所以一旦我获得请求的授权签名,我将其作为标题附加到请求中:
String auth = ...CUSTOM ALGORITHM ...;
String pragma = ... OTHER CUSTOM HEADER ...;
RequestSpecification requestSpec = new RequestSpecBuilder()
.addHeader("Authorization", auth)
.addHeader("pragma", pragma)
.build();
RestAssured.baseURI = "https://blahblah.staging.somewhere.net";
RestAssured.port = 443;
RestAssured.basePath = "/endpoint_name/somefolder/resource?status=active";
RestAssured.urlEncodingEnabled = false;
requestSpec.get();
这会导致以下错误:
java.lang.NullPointerException:无法在空对象上获取属性“assertionClosure”