Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Does the Intellij HTTP client plugin have a CI package that can run outside the IDE?

When using Intellij’s HTTP Client, you can write a file with the extension .http and the plugin allows you to run HTTP requests from the IDE. Let’s call it my-tests.http

my-tests.http

### Check response status, headers, and content-type
GET https://httpbin.org/get

{%
client.test("Request executed successfully", function() {
    client.assert(response.status === 200, "Response status is not 200");
});

client.test("Headers option exists", function() {
    client.assert(response.body.hasOwnProperty("headers"), "Cannot find 'headers' option in response");
});

client.test("Response content-type is json", function() {
    var type = response.contentType.mimeType;
    client.assert(type === "application/json", "Expected 'application/json' but received '" + type + "'");
});
%}

Is there a tool that can be used in Continuous Integration environments to run this .http file from the commandline?

I’m looking for a like maybe a bash script or Python executor that would be invoked like ./cool-script my-tests.http that returns 0 if everything passed. It would also allow you to run a specific test, as in ./cool-script my-tests.http --test=3 to only run the third request (there is only 1 in my example above, GET https://httpbin.org/get).

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can try https://httpx.sh/.

See the related feature request and comments.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading