
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
org.mikeneck.httpspec:http-spec-runner
Advanced tools
Testing library for http API with DSL and jsonpath assertion.
http-spec is a library for web services to describe REST API specification.
This library build on top of Java 11's http API.
spec:
- name: 'getting path resource with paging parameters'
request:
get: 'http://localhost:8080/path'
queries:
q: test
page: 4
limit: 10
headers:
accept: application/json
authorization: bearer 11aa22bb33cc
response:
status: 200
headers:
content-type: application/json
body:
- path: $.firstName
expect:
type: string
value: John
class RestApiTest {
@Test
void runRequestFromYamlFile() {
var yamlFile = new File("/path/to/spec.yaml");
HttpSpecRunner.from(yamlFile).run(); // runs all requests and asserts responses.
}
}
class RestApiTest {
@Test
void runRequestByJavaCode() {
HttpSpecRunner.Builder builder = HttpSpecRunner.builder();
builder.addSpec(spec -> {
spec.name("getting path resource with paging parameters");
spec.request().get("http://localhost:8080/path", request -> {
request.query("q", "test");
request.query("page", 4);
request.query("limit", 10);
request.header("accept", "application/json");
request.header("authorization", "bearer 11aa22bb33cc");
});
spec.response(response -> {
response.status(200);
response.header("content-type", "application/json");
response.jsonBody(jsonBody -> jsonBody.path("$.firstName").toBe("John"));
});
});
HttpSpecRunner httpSpecRunner = builder.build();
httpSpecRunner.run(); // runs all requests and asserts responses.
}
}
T.B.D.
With junit-jupiter module, you can convert HttpSpecRunner
into Stream<DynamicTest>
.
import java.util.stream.Stream;
class RestApiTest {
// With junit-jupiter module, you can use httpSpecRunner as dynamic tests.
@TestFactory
Stream<DynamicTest> asDynamicTests() {
HttpSpecRunner.Builder builder = HttpSpecRunner.builder();
// same as the code in runRequestByJavaCode
HttpSpecRunner httpSpecRunner = builder.build();
// converts each assertion to dynamicTest
// - http status to be 200
// - content-type header to be application/json
// - body json has element $.firstName to be John
return DynamicTestAdapter.adapt(httpSpecRunner);
}
}
FAQs
Unknown package
We found that org.mikeneck.httpspec:http-spec-runner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.