• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

forst-lang / forst / 24750001776

21 Apr 2026 10:35PM UTC coverage: 76.323% (+0.03%) from 76.292%
24750001776

Pull #96

github

haveyaseen
test(sidecar): add route-to-Forst integration tests and Express 4 dev deps

Wire Express + createRouteToForstMiddleware against a stub dev server (connect
mode, GET /health + POST /invoke/raw) to assert full routed request fidelity
(session-style headers, query, body) and mirrored HTTP response; cover streaming
passthrough. Extend unit tests for mapRequest header injection and next(err) on
invoke failure. Pin express@^4 and @types/express@^4 under devDependencies so
Bun tests run (Express 5 router currently breaks under Bun); peer remains
express ^5.
Pull Request #96: feat(sidecar)!: stream request bodies and add route middleware

286 of 289 new or added lines in 11 files covered. (98.96%)

288 existing lines in 9 files now uncovered.

21385 of 28019 relevant lines covered (76.32%)

89.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.63
/forst/internal/devserver/handler_invoke_raw.go
1
package devserver
2

3
import (
4
        "encoding/json"
5
        "fmt"
6
        "io"
7
        "net/http"
8
)
9

10
// handleInvokeRaw is like handleInvoke but the POST body is **only** the JSON array of arguments.
11
// Package and function come from query parameters: package, function, optional streaming=true.
12
// Node clients can forward the raw request body (e.g. after express.raw) without parsing into V8 objects first.
13
func (s *DevServer) handleInvokeRaw(w http.ResponseWriter, r *http.Request) {
8✔
14
        if r.Method != http.MethodPost {
10✔
15
                s.sendError(w, "Method not allowed", http.StatusMethodNotAllowed)
2✔
16
                return
2✔
17
        }
2✔
18
        pkg := r.URL.Query().Get("package")
6✔
19
        fn := r.URL.Query().Get("function")
6✔
20
        if pkg == "" || fn == "" {
7✔
21
                s.sendError(w, "query parameters package and function are required", http.StatusBadRequest)
1✔
22
                return
1✔
23
        }
1✔
24
        streaming := r.URL.Query().Get("streaming") == "true"
5✔
25

5✔
26
        raw, err := io.ReadAll(r.Body)
5✔
27
        if err != nil {
5✔
NEW
28
                s.sendError(w, fmt.Sprintf("read body: %v", err), http.StatusBadRequest)
×
NEW
29
                return
×
NEW
30
        }
×
31
        if len(raw) == 0 {
6✔
32
                s.sendError(w, "body is required (JSON array of arguments)", http.StatusBadRequest)
1✔
33
                return
1✔
34
        }
1✔
35
        if !json.Valid(raw) {
5✔
36
                s.sendError(w, "body must be valid JSON", http.StatusBadRequest)
1✔
37
                return
1✔
38
        }
1✔
39
        var probe []json.RawMessage
3✔
40
        if err := json.Unmarshal(raw, &probe); err != nil {
4✔
41
                s.sendError(w, "body must be a JSON array", http.StatusBadRequest)
1✔
42
                return
1✔
43
        }
1✔
44

45
        s.invokeWithArgs(w, r, pkg, fn, json.RawMessage(raw), streaming)
2✔
46
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc