Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ flow run human_approval.flow.yaml

**What happens?**
- The flow sends an SMS for approval.
- It pauses until a reply is received (via webhook or manual event).
- It pauses until a reply is received (via HTTP endpoint or manual event).
- When the human replies, the flow resumes and prints the result.

---
Expand Down Expand Up @@ -479,8 +479,8 @@ flow run cfo_daily_cash.flow.yaml

```yaml
name: ecommerce_autopilot
on: schedule.interval
every: "1h"
on: schedule.cron
cron: "0 * * * *" # Every hour

vars:
MIN_MARGIN_PCT: 20
Expand Down Expand Up @@ -617,7 +617,7 @@ steps:

✨ **Templating:** `{{…}}` gives you outputs, vars, secrets, helper funcs.

⏳ **Durable waits:** `await_event` pauses until external approval / webhook.
⏳ **Durable waits:** `await_event` pauses until external approval / HTTP event.

⚡ **Parallelism & retries:** `parallel: true` blocks and `retry:` back-offs.

Expand Down Expand Up @@ -686,7 +686,7 @@ BeemFlow provides **three complementary ways** to integrate with HTTP APIs and e
**How it works:**
- **Complete HTTP control** - any method, headers, body, authentication
- **No assumptions** - you specify exactly what gets sent
- **Perfect for** - REST APIs, webhooks, custom protocols
- **Perfect for** - REST APIs, HTTP endpoints, custom protocols
- **Raw power** - handles any HTTP scenario

### 🚀 Pattern 3: MCP Servers (For complex integrations)
Expand Down Expand Up @@ -725,7 +725,7 @@ BeemFlow provides **three complementary ways** to integrate with HTTP APIs and e
| Custom REST API (advanced) | MCP server | `mcp://my-api/search` with caching, retries, etc. |
| Database queries | MCP server | `mcp://postgres/query` |
| File processing | MCP server | `mcp://filesystem/read` |
| One-off webhook/custom request | Generic HTTP | `http` with custom headers |
| One-off HTTP/custom request | Generic HTTP | `http` with custom headers |

### Testing All Patterns

Expand Down
15 changes: 10 additions & 5 deletions adapter/http_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ import (
"os"
"regexp"
"strings"
"time"

"github.com/awantoch/beemflow/constants"
"github.com/awantoch/beemflow/registry"
"github.com/awantoch/beemflow/utils"
)

// defaultClient is used for HTTP requests with a timeout to avoid hanging.
var defaultClient = &http.Client{Timeout: 30 * time.Second}
// getHTTPClient returns an HTTP client that respects context deadlines
func getHTTPClient() *http.Client {
return &http.Client{
// Don't set a timeout here - let the context handle timeouts
// This allows proper context cancellation and deadline handling
}
}

// Environment variable pattern for safe parsing
var envVarPattern = regexp.MustCompile(`\$env:([A-Za-z_][A-Za-z0-9_]*)`)
Expand Down Expand Up @@ -148,8 +152,9 @@ func (a *HTTPAdapter) executeHTTPRequest(ctx context.Context, req HTTPRequest) (
}
httpReq.Header.Set(constants.HeaderAccept, constants.DefaultJSONAccept)

// Execute request
resp, err := defaultClient.Do(httpReq)
// Execute request with context-aware client
client := getHTTPClient()
resp, err := client.Do(httpReq)
if err != nil {
return nil, utils.Errorf("HTTP request failed: %w", err)
}
Expand Down
88 changes: 0 additions & 88 deletions api/index.go

This file was deleted.

189 changes: 0 additions & 189 deletions api/index_test.go

This file was deleted.

5 changes: 0 additions & 5 deletions cmd/flow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ func newServeCmd() *cobra.Command {
}

utils.Info("Starting BeemFlow HTTP server...")
// Skip actual server start in tests
if os.Getenv("BEEMFLOW_TEST") == "1" {
utils.User("flow serve (test mode)")
return
}
if err := beemhttp.StartServer(cfg); err != nil {
utils.Error("Failed to start server: %v", err)
exit(1)
Expand Down
Loading