github gofr-dev/gofr v1.48.0

8 hours ago

Release v1.48.0

🚀 New Features

🔹 Unified Token-Bucket Rate Limiter for HTTP Clients

GoFr introduces a brand-new, pluggable rate limiter that works across all HTTP client calls.

Key Highlights:

  • Supports in-memory and Redis-backed stores
  • Simple drop-in integration via RateLimiterConfig or AddOption
  • Integer-only token bucket with burst support
  • Background cleanup for local buckets
  • Customizable request grouping using KeyFunc

Why this matters:

  • Ensures consistent throttling across all downstream HTTP services
  • Distributed apps can now safely rate-limit using Redis

Additional Details :

  • Default limit: 60 req/min, burst 10
  • Returns RateLimitError (429) with RetryAfter for easy handling.

📦 Improvements

🔹 HTTP Client Enhancements with Rate Limiting

  • Rate limiter now acts as an HTTP wrapper, intercepting all Get/Post/Put/Delete calls (including header variants)

  • Service key normalization improved via default keying (scheme://host)

  • Cleaner validation through RateLimiterConfig.Validate() with automatic sane defaults

🔹 SQL Operation Normalization

  • SQL operation detection now always returns UPPERCASE keywords. Improves reliability for middleware and query inspection logic.

🔹 OAuth Token URL Validation Cleanup

  • Switched to shared scheme constants (http / https). Reduces duplicated literals and improves code clarity

🐛 Bug Fixes & Small Changes

🔹 Consistent SQL Operation Detection

  • getOperationType() now normalizes to uppercase, preventing case-sensitivity issues across modules

🔹 Documentation Updates

  • HTTP communication guide adds all details to add rate-limiter in your registered HTTP Services. Added examples for:
    • In-memory usage
    • Redis-backed multi-instance usage
    • Custom keying functions
  • Added Documentation to setup gRPC Streaming Services/Clients using GoFr.

Refer : GoFr Official Documentation

Don't miss a new gofr release

NewReleases is sending notifications on new releases.