rails-http-lab 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +15 -0
- data/README.md +60 -0
- data/app/assets/javascripts/rails_http_lab/application.js +1318 -0
- data/app/assets/stylesheets/rails_http_lab/application.css +336 -0
- data/app/controllers/rails_http_lab/application_controller.rb +47 -0
- data/app/controllers/rails_http_lab/collections_controller.rb +20 -0
- data/app/controllers/rails_http_lab/environments_controller.rb +33 -0
- data/app/controllers/rails_http_lab/folders_controller.rb +47 -0
- data/app/controllers/rails_http_lab/requests_controller.rb +99 -0
- data/app/controllers/rails_http_lab/runs_controller.rb +34 -0
- data/app/controllers/rails_http_lab/ui_controller.rb +7 -0
- data/app/views/layouts/rails_http_lab.html.erb +14 -0
- data/app/views/rails_http_lab/ui/index.html.erb +103 -0
- data/config/routes.rb +24 -0
- data/lib/generators/rails_http_lab/install/install_generator.rb +41 -0
- data/lib/generators/rails_http_lab/install/templates/initializer.rb.tt +20 -0
- data/lib/rails-http-lab.rb +1 -0
- data/lib/rails_http_lab/bruno/block.rb +44 -0
- data/lib/rails_http_lab/bruno/document.rb +36 -0
- data/lib/rails_http_lab/bruno/parser.rb +207 -0
- data/lib/rails_http_lab/bruno/serializer.rb +68 -0
- data/lib/rails_http_lab/bruno.rb +12 -0
- data/lib/rails_http_lab/configuration.rb +51 -0
- data/lib/rails_http_lab/engine.rb +25 -0
- data/lib/rails_http_lab/execution/response.rb +20 -0
- data/lib/rails_http_lab/execution/runner.rb +187 -0
- data/lib/rails_http_lab/execution/variable_resolver.rb +30 -0
- data/lib/rails_http_lab/execution.rb +3 -0
- data/lib/rails_http_lab/storage/filesystem.rb +123 -0
- data/lib/rails_http_lab/storage/tree.rb +120 -0
- data/lib/rails_http_lab/storage.rb +2 -0
- data/lib/rails_http_lab/version.rb +3 -0
- data/lib/rails_http_lab.rb +14 -0
- metadata +92 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 455a98547ed2be13947848e16d5225d1107b5a4cbce170ebf6b5d8bcfcdf071a
|
|
4
|
+
data.tar.gz: b38a9225af1559ad6ead838f4fede715ac4ed399fd2d9fd6c79e32787d400714
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 895dc4334974bb9bb08e07a8fdbcb3f4e8f7b50fa7b7ed846930fdd63cf49d3a9e3ec28b94167bc7cc6bf0963ba649b000eb89f51c2fd4daf41a3fec9dbf90a2
|
|
7
|
+
data.tar.gz: 84f1c94df54f49893c87e0790de96acc2d574eddf9d664222e08d6ea4866a0994f831099c630fd76e2358059093d143fb23edd83aabc50f567c5988c599cf7bb
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jackson Pires
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
|
data/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# rails-http-lab
|
|
2
|
+
|
|
3
|
+
In-app HTTP request lab for Rails. Mounts a UI at `/rails/http-lab` and persists collections as `.bru` files that are interchangeable with the [Bruno](https://www.usebruno.com/) desktop app.
|
|
4
|
+
|
|
5
|
+
No external app, no separate workspace — your requests live next to the code that serves them, version-controlled in `docs/http-lab/`.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Why
|
|
10
|
+
|
|
11
|
+
Postman / Insomnia / Bruno are great, but every one of them lives outside your
|
|
12
|
+
Rails app and outside your repo. With `rails-http-lab`:
|
|
13
|
+
|
|
14
|
+
- Requests are **files in the repo** (`docs/http-lab/*.bru`), reviewable in PRs.
|
|
15
|
+
- The UI runs **inside your Rails app** — no CORS, can reach internal services.
|
|
16
|
+
- Files use the **Bruno format**, so the same collection opens in Bruno desktop.
|
|
17
|
+
Round-trip is byte-stable (verified against the public Bruno corpus).
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
# Gemfile
|
|
23
|
+
gem "rails-http-lab", group: :development
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
bundle install
|
|
28
|
+
bin/rails g rails_http_lab:install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Visit `http://localhost:3000/rails/http-lab`.
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
`config/initializers/rails_http_lab.rb`:
|
|
36
|
+
|
|
37
|
+
```ruby
|
|
38
|
+
RailsHttpLab.configure do |c|
|
|
39
|
+
c.mount_path = "/rails/http-lab" # default
|
|
40
|
+
c.storage_path = Rails.root.join("docs/http-lab") # default
|
|
41
|
+
c.enabled_envs = %i[development] # default
|
|
42
|
+
# c.authenticator = ->(request) { request.session[:admin] }
|
|
43
|
+
end
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Security
|
|
47
|
+
|
|
48
|
+
The executor performs HTTP requests **from the Rails server**. That's the point —
|
|
49
|
+
it lets you reach internal services without CORS. It is also a confused-deputy
|
|
50
|
+
risk if exposed to untrusted users. Defaults:
|
|
51
|
+
|
|
52
|
+
- Enabled only in `development` (`enabled_envs`).
|
|
53
|
+
- Enabling in `production` requires an `authenticator` callable; the engine
|
|
54
|
+
refuses to boot otherwise.
|
|
55
|
+
- Bruno `script` and `tests` blocks are **persisted but not executed** to avoid
|
|
56
|
+
arbitrary code execution. Run them in Bruno itself.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|