Posted about 1 month ago. Visible to the public. Repeats.

HTTP Client in RubyMine

RubyMine has a HTTP Client that can be useful to test web APIs.
Just create a .http scratch file an write your request in it.
The request can then be executed with the "Run all requests in File" button above the file.

Some alternatives:

The format for request is like this:

Method Request-URI HTTP-Version Header-field: Header-value Request-Body

Some examples:

// A basic get request GET
// A POST with json body POST Content-Type: application/json { "key" : "value" }

It also supports multiple sequential requests, with a JS-API to parse and reuse responses in later requests.
So lets say you need to retrieve an authtoken first and then make your request, you could do:

POST Content-Type: application/json { "token": "my-secret-token" } // Saving a variable > {%"auth_token", response.body.token); %} ### //Accessing a variable GET Authorization: Bearer {{auth_token}}

Complete documentation can be found here:

By refactoring problematic code and creating automated tests, makandra can vastly improve the maintainability of your Rails application.

Owner of this card:

Martin Schaflitzl
Last edit:
26 days ago
by Dominik Schöler
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Martin Schaflitzl to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more