Closed apatrida closed 2 years ago
Is it only running tests for OK 200 status responses and not all responses? If so, this differs from IntelliJ IDEA which always runs the tests/assertions (i.e. you are testing for the error intentionally)
@apatrida it's a bug. Now JS test only works when response body is not empty and content-type is json. I will fix this bug ASAP.
String contentType = responseHeaders.get("Content-Type");
return byteBufMono.asByteArray().doOnNext(content -> {
if (contentType != null && isPrintable(contentType)) {
if (contentType.contains("json")) {
final String result = new String(content, StandardCharsets.UTF_8);
final String body = prettyJsonFormatWithJsonPath(result, httpRequest.getHeader("X-JSON-Path"));
System.out.print(body);
final String javaScriptTestCode = httpRequest.getJavaScriptTestCode();
if (javaScriptTestCode != null && !javaScriptTestCode.isEmpty()) {
System.out.println();
System.out.println("============Execute JS Test============");
final String jsTestOutput = Nodejs.executeHttpClientCode(javaScriptTestCode, httpStatus.code(), httpResponseHeaders, contentType, result);
System.out.println(jsTestOutput);
}
} else {
System.out.print(new String(content));
}
}
});
thanks
Released with version 0.36.0 https://github.com/servicex-sh/httpx/releases/tag/v0.36.0
Running httpx with
-a
with 4 targets, each having a JS test, it only indicates it is running for one or two of the middle 2.test file:
and output from httpx