Another tool for testing HTTP(s)

Romanus
5 min readSep 13, 2022

--

Hello friends! I made a small tool with which you can
check the correctness of the responses of the endpoints on the Web and RESTful resources.

Preface

To begin with, why do we need another way to test endpoints? I use cURL and Postman tools in my daily work, both are great apps,
but after a certain time of use I noticed some “inconvenience” when working with them. Let’s look at them in order.

cURL is absolute freedom in everything, you can write the parts of the request in any order. Some inconvenience can be in the terminal with the result of the answer, especially if it is large. It don’t have highlighting and formatting.

Postman — here everything is laid out on the shelves in the GUI. The problem with the results of the answers here is solved much better.
There is formatting and syntax highlighting. The inconvenience here is that there are too many GUI shelves and when you need to change something in your queries you need to frequently switch between GUI shelves (I mean tabs and fields) even for a single query.

So for me, “the conditionally ideal” tool is the one that allows you to freely typing request in text form, but at the same time it allows you to see the result formatted and with syntax highlighting. I was looking for such a tool but did not find it (maybe I was looking badly) and without thinking twice, I decided to make my own application for resolve this issue.

Where download?

There are currently binary builds for Windows and Linux. You can download them from here.

How it works?

So let’s see how the application works. The application consists of two parts (or tabs if you wish): Query Editor and Result View, you can switch between them using the F11 key. Let’s start with a simple example, I want to make a simple request with no parameters that only consists of a url.

After launching the application, type the text in the selected line:

url https://jsonplaceholder.typicode.com/todos/1

Press Ctrl-Z and wait for the request to complete. A progress bar is shown next to the Result text in the window header. The clock icon means that the request is being executed, when the green check mark means that the request has been completed.

If everything is in order, you can proceed to view the result (F11 key). You can see the response code, execution time and size in two modes it bytes and human readable format. You also can inspect the response headers and response body. It is possible to search for arbitrary text in the response. It is enough to type the filter in a special text field
the focus on which will immediately stand after going to the Results View and press Enter. You can switch between the lines pressing Ctrl-Alt-Down and Ctrl-Alt-Up.

Now let’s try to send a request with a parameter. We return to the query editor by pressing F11. Change the text in the first field to the following:

url https://jsonplaceholder.typicode.com/comments

Next, press Ctrl-Enter to create another line into which we typing:

param postId=1

Before making the request, URL will be changed like this https://jsonplaceholder.typicode.com/comments?postId=1
It will attach the parameter to URL. You can add multiple param fields, they will all be attached to the url before executing the request.

Now let’s try to send a POST request, to do this, delete the extra line with the parameter, to delete it, make sure that the line is highlighted with a blue frame and press Shift-Alt-R. Press Ctrl-Enter to add a new line and type text:

met POST

Hint: You can also specify PUT and DELETE (default is GET). Add another line Ctrl-Enter and write in it:

json { “userId”: 1, “id”: 1, “title”: “test”, “body”: “my body” }

We just have to edit the url for this, press Ctrl-PageUp and change the line from the url to the following:

url https://jsonplaceholder.typicode.com/posts

Hint: Ctrl-PgUp/Ctrl-PgDown — to select the first and last line. PgUp/PgDown — to select row above and below.

Now you can execute the query (Ctrl-Z). As a result, we should receive our body in the form in which we sent it.

Json text is written as a single line but you can write it in the normal way like this:

json

{

“userId”: 1

}

the only thing to remember is that the line must start with `json` at the end of the space and it must be there.
Also, in addition to the json command, you can use xmla and body. json and xmla commands are aliases for body but along with them add the necessary headers automatically.

Now let’s add a header to the request, let’s say we need to add an authorization header. To do this, we add new line and write in it:

Authorization bearer 45345345345230584230594820359408230540234

Of course, a real token will not look like this, but for an example it will do.
This way you can add any header supported by the HTTP standard and
also headers starting with X-. Any custom headers are added with the header command e.g. header MYCUSTOMHEADER 20.

You may need to save query lines somewhere, for example, to the clipboard. To do this, press Ctrl-S. You can load from the clipboard by pressing Shift-Alt-L if you want to clear all lines and replace them on
lines from clipboard or Ctrl-L to add lines below the selected line.

A few quick examples

How to make a request with a form:

url http://localhost:5000/api/v1/templates/add
met POST
form query=list
form page=1
form perPage=1
Content-Type application/x-www-form-urlencoded

How to make a request with a form and a file:

url http://localhost:5000/api/v1/templates/add
met PUT
form name=Tester
form description=Description
file file=C:\work\page1.jpg
Content-Type application/x-www-form-urlencoded

How to make a request with multiple values in the Cookie header:

url http://localhost:5000/api/v1/user/
pastry token=121212121212121212121
pastry userid=20

You can get acquainted with all keyboard commands by pressing F1 or Ctrl-H.

I have described in this article only a few of the most requested commands and features. The application has other features that you can explore at this link https://github.com/trueromanus/ArdorQuery#fields-commands

If you have questions or suggestions, leave them in the comments or on github. Thanks!

--

--