Skip to content

Commit 8e706ea

Browse files
committed
Improve Insomnia endpoint extraction
1 parent 637256e commit 8e706ea

3 files changed

Lines changed: 320 additions & 50 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
type: collection.insomnia.rest/5.0
2+
name: Insomnia Edge Cases
3+
meta:
4+
id: wrk_edge
5+
created: 1771459200000
6+
modified: 1771459200000
7+
environments:
8+
data:
9+
hosts:
10+
api: https://api.example.com
11+
token: edge-token
12+
collection:
13+
- name: HTTP
14+
meta:
15+
id: fld_http
16+
children:
17+
- name: User detail
18+
meta:
19+
id: req_user_detail
20+
method: GET
21+
url: "{{ _.hosts.api }}/users/{userId}?include=posts"
22+
parameters:
23+
- name: page
24+
value: "1"
25+
- name: disabled
26+
value: skip
27+
disabled: true
28+
pathParameters:
29+
- name: userId
30+
value: "42"
31+
headers:
32+
- name: ""
33+
value: skip
34+
- name: Host
35+
value: api.example.com
36+
authentication:
37+
type: bearer
38+
token: "{{ token }}"
39+
- name: Session
40+
meta:
41+
id: req_session
42+
method: POST
43+
url: /sessions/{{ session_id }}
44+
body:
45+
mimeType: application/json
46+
text: '{"username":"alice","password":"secret"}'
47+
- name: Host without scheme
48+
meta:
49+
id: req_host_without_scheme
50+
method: GET
51+
url: localhost:3000/status
52+
- name: Relative without leading slash
53+
meta:
54+
id: req_relative_without_slash
55+
method: GET
56+
url: api/v1/relative
57+
- name: Diagnostics trace
58+
meta:
59+
id: req_diagnostics_trace
60+
method: TRACE
61+
url: https://api.example.com/diagnostics
62+
- name: WebSocket is not HTTP
63+
meta:
64+
id: ws-req_socket
65+
url: ws://localhost:3000/socket
66+
headers:
67+
- name: X-Socket
68+
value: skip
69+
- name: GRPC is not HTTP
70+
meta:
71+
id: grpc_req
72+
url: grpc://localhost:50051/example.Service/Call
73+
body:
74+
text: "{}"

spec/functional_test/testers/specification/insomnia_spec.cr

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,25 @@ FunctionalTester.new("fixtures/specification/insomnia/folders/", {
4343
:techs => 1,
4444
:endpoints => 2,
4545
}, nil).perform_tests
46+
47+
edge_endpoints = [
48+
Endpoint.new("/users/{userId}", "GET", [
49+
Param.new("include", "", "query"),
50+
Param.new("page", "1", "query"),
51+
Param.new("userId", "42", "path"),
52+
Param.new("Authorization", "Bearer edge-token", "header"),
53+
]),
54+
Endpoint.new("/sessions/:session_id", "POST", [
55+
Param.new("session_id", "", "path"),
56+
Param.new("username", "", "json"),
57+
Param.new("password", "", "json"),
58+
]),
59+
Endpoint.new("/status", "GET"),
60+
Endpoint.new("/api/v1/relative", "GET"),
61+
Endpoint.new("/diagnostics", "TRACE"),
62+
]
63+
64+
FunctionalTester.new("fixtures/specification/insomnia/edgecases/", {
65+
:techs => 1,
66+
:endpoints => edge_endpoints.size,
67+
}, edge_endpoints).perform_tests

0 commit comments

Comments
 (0)