The Request: Logging out Response Header and Body Data The Request can be tested and traversed with JavaScript. The HTTP Client allows a great deal of control regarding the handling of the Response.Īccessing and traversing the Response in json-format is pretty straightforward and nested objects can be accessed arbitrarily deep. QR-Code Preview: QR-Code Preview Working with the Response The Preview Feature also works with QR-Codes:Įndpoint: Serving the QR-Code with ZXing and hiding the content with impeccable editing skills We receive this image of coffee! Coffee Shop Love Given following Endpoint providing an image of coffee: A Java EndpointĪnd a Request to retrieve the data: GET Request for the Image Instead of human unreadable data, we get a coherent image. If an endpoint responds with an image, a preview of said image is viewable. This behavior can be disabled by tagging the Request with Image Previews For this example I will use Java in combination with Spring-Boot.Ī DemoController with a Requestmapping of „/api“ with the following endpoints is set up and called: Redirection endpoint of the DemoController Per default, any Request with an HTTP status of 302 FOUND will be followed. POST Request with a random integer as Path Variable A scratch file with the added URL Syntaxįor those experienced in working with common API tools the syntax should feel familiar and intuitive. http scratch file encompassing the url of the endpoint. Or selecting it on the Endpoints Tab: The Endpoints tab gives you an overview of your API http file is as easy as clicking an icon on a given Requesthandler method Clicking the green icon will create a generated-requests.http file Manually create a file with an extension of. Getting startedįirst, we have to create a.
http files solve this issue by having everything set up and ready to go.
#Http client test how to
Having to ask which credentials one needs and subsequently how to obtain them to converse with certain endpoints impedes the general workflow.
This facilitates testing the API of various services without the need to cumbersomely import configurations or collections. Easily executable by pressing the Run Button. http files are extremely useful since they can be stored inside a VCS repository and are essentially easily modifiable, functional and declarative API documentation akin to OpenAPI and Swagger. Scratch files are handy for local development, but are not tracked by your Version Control System. Scratch files are not stored inside the project, whereas physical files are. Here, a distinction is made between scratch and physical files. They simply store the HTTP Requests for execution. http files are at the heart of the client. rest files without being required to leave the IDE.įor simplicity’s sake, we will henceforth only consider. It facilitates Web Service testing by leveraging easily accessible. This is where IntelliJ IDEA’s HTTP Client really shines due to its simplicity and ease of use. through an elaborate embedded HTTP Client.ĪPI tools often times have an unnecessary steep learning curve, coupled with the tendency to do little in terms of developer-friendliness. IntelliJ IDEA Ultimate provides a powerful alternative to common API tools such as Postman, Rest-Assured, cUrl etc.