JDriven Blog

IntelliJ HTTP Client: Re-using Javascript In Pre-Request And Response Handlers

Posted on by  
Hubert Klein Ikkink

When we use the IntelliJ HTTP Client we can write Javascript for the pre-request and response handlers. The Javascript code must be in between {% …​ %} delimeters. If we want to re-use Javascript functions in the pre-request or response handlers we can store them in an external Javascript file. Then we use the import statement to import either the whole file or specify explicitly the code we want to import. This way we can reuse code for different pre-request and response handlers.

Continue reading →

IntelliJ HTTP Client: Using External Files As JSON Payload

Posted on by  
Hubert Klein Ikkink

The built-in IntelliJ HTTP Client is very useful for testing HTTP requests and responses. We can use it to test for example a REST API that works with JSON data. If an endpoint expects a JSON payload we can specify the payload in our HTTP Client request file. But if we have a lot of endpoints and large payload the request file can get big and messy. Instead of having the payload in the request file directly we can specify an external JSON file with the payload and use it for a request body. We must use the < operator and give the name of the file with our JSON payload. The IntelliJ HTTP Client will read the contents of that file and use it as the request body. The payload may also contain (dynamic) variables and those variables will be replaced with correct values when the request is executed.

Continue reading →

The Michael Jordan Approach to Software Engineering

Posted on by  
Erik Pronk

When we think of greatness in the world of sports, one name that immediately pops in my mind is Michael Jordan. Widely regarded as the greatest basketball player of all time, Jordan’s approach to his craft is legendary. While the world of software engineering might seem miles apart from the basketball court, there are valuable lessons we as software engineers can learn from the Michael Jordan approach and apply them to our work as software engineers.

Continue reading →

Working From Abroad

Posted on by  
Justus Brugman

Those who come here know that the blogs here mainly have a technical angle. This time it’s a little bit different for me. Why? Because I started following my dream: Working from abroad.

Continue reading →

jq Joy: Sum Of Elements In An Array Or Object

Posted on by  
Hubert Klein Ikkink

jq is a powerful tool to work with JSON from the command-line. The tool has a lot of functions that makes our live easier. One of the functions is add which adds all elements in an array or values in an object. The function has no arguments. The elements in an array are added together if they are numbers and concatenated if they are strings. If the input is an object then the values are added together. When the input is an empty array or object then null is returned.

Continue reading →

jq Joy: Using String Interpolation

Posted on by  
Hubert Klein Ikkink

jq is a powerful tool to work with JSON from the command-line. The tool has a lot of functions that makes our live easier. With jq we can use expressions in strings that will be evaluated and inserted into the string value. This is called string interpolation. The expression is enclosed by parentheses and the first parenthesis is prefixed with a backslash: \(<expression>). The expression can be any valid jq expression and the result of the expression will be inserted into the string.

Continue reading →

jq Joy: Getting Keys From Object And Indices From Array

Posted on by  
Hubert Klein Ikkink

jq is a powerful tool to work with JSON from the command-line. The tool has a lot of functions that makes our live easier. For example we can use the keys and keys_unsorted functions to get the keys from an object. The function keys will return the keys in sorted order while keys_unsorted will return them in the original order from the object. With the same functions we can also get the indices of the elements in an array, but there is no sorting involved, so both functions return the same output.

Continue reading →

shadow-left