Send JSON as parameter in url using RestTemplate

If you try to send the json as a parameter in url via Spring’s RestTemplate, you will encounter the following error: In order to solve this problem, you need to: Encode the URL yourself Disable url encoding at the RestTemplate level. Let’s do that: Many thanks to Chris Liu for showing how to disable url […]

READ MORE

How to delete PushGateway groups

In this article, we are going to figure out, how to delete PushGateway metrics/groups. Let’s also answer the question – why “PushGateway metrics delete not working” or “PushGateway groups delete not working”. First of all, you must specify all the keys of the group that you want to delete.You need to delete groups with such […]

READ MORE

Spring Boot REST vs gRPC compatibility

Suppose you are using Spring Boot and you have a REST controller: At some point you need to connect the gRPC to the project without disabling REST controller. The gRPC code looks something like this: Then you find out that you can’t start REST server together with gRPC. gRPC will start, but REST will not. […]

READ MORE

REST endpoint stub in Java

Making a REST server Let me remind you that earlier we talked about setting up a REST server for unit tests in JUnit. We will also be using the WireMock tool today. Information about adding WireMock to the project can be found in the previous article. Configuring server parameters For HTTP: For HTTPS: To use […]

READ MORE

REST endpoint stub in JUnit

Suppose you want to test method X. It requests data from a specific endpoint Y. In this article, we’ll talk about three things: how to start a REST server within a unit test; how to set up data transmission on Y; how to check the number of requests received on Y. For information on how […]

READ MORE