# go-resty/resty

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/go-resty-resty).**

11,704 stars · 783 forks · Go · MIT

## Links

- GitHub: https://github.com/go-resty/resty
- Homepage: https://resty.dev
- awesome-repositories: https://awesome-repositories.com/repository/go-resty-resty.md

## Topics

`backoff` `circuit-breaker` `curl-command` `digest-authentication` `go` `go-library` `go-resty` `golang` `golang-library` `hacktoberfest` `http-client` `http-trace` `load-balancer` `middleware` `redirects` `rest-client` `retry` `service-discovery` `srv-record` `sse-client`

## Description

Resty is a high-level HTTP client library for Go designed for consuming REST services. It provides a streamlined interface for executing network requests, managing server-sent event streams, and automatically mapping JSON and XML responses into data structures.

The library includes built-in mechanisms for service resilience and traffic management, such as circuit breakers to prevent cascading failures, token-bucket rate limiting, and automated request retries with exponential backoff. It also features client-side load balancing to distribute outgoing traffic across multiple base URLs and request hedging to reduce tail latency.

The capability surface covers request interception via middleware, detailed network observability through request tracing and correlation tracking, and support for multipart form data uploads. For debugging, the library can generate curl commands from requests and provide customized network traffic logging.

Security is handled through implementations of HTTP digest authentication.

## Tags

### Development Tools & Productivity

- [REST APIs](https://awesome-repositories.com/f/development-tools-productivity/rest-apis.md) — Provides a high-level Go client for consuming REST services with automatic JSON and XML parsing.
- [cURL Command Generators](https://awesome-repositories.com/f/development-tools-productivity/curl-command-generators.md) — Converts programmatic HTTP requests into curl command strings for debugging and sharing. ([source](https://github.com/go-resty/resty/blob/v3/curl.go))

### Networking & Communication

- [HTTP Client Libraries](https://awesome-repositories.com/f/networking-communication/http-client-libraries.md) — Provides a high-level, streamlined interface for executing network requests to remote servers and processing responses. ([source](https://github.com/go-resty/resty/blob/v3/go.mod))
- [Server-Sent Events](https://awesome-repositories.com/f/networking-communication/server-sent-events.md) — Consumes real-time data streams from servers using long-lived connections and event callbacks. ([source](https://github.com/go-resty/resty/blob/v3/resty.go))
- [Circuit Breakers](https://awesome-repositories.com/f/networking-communication/traffic-management-gateways/circuit-breakers.md) — Blocks requests to downstream services when a failure threshold is reached to prevent cascading system collapses.
- [High Availability Routing](https://awesome-repositories.com/f/networking-communication/high-availability-routing.md) — Ensures continuous connectivity by distributing traffic across multiple URLs using load balancing and hedging.
- [Response Decompression](https://awesome-repositories.com/f/networking-communication/http-clients/response-decompression.md) — Automatically decompresses HTTP response bodies using formats like gzip and deflate via the content-encoding header. ([source](https://github.com/go-resty/resty/blob/v3/stream.go))
- [HTTP Request Debugging](https://awesome-repositories.com/f/networking-communication/http-request-debugging.md) — Supports network troubleshooting by logging detailed request timings, capturing headers and generating curl commands.
- [Load Balancers](https://awesome-repositories.com/f/networking-communication/load-balancers.md) — Implements client-side load balancing to distribute outgoing network traffic across multiple base URLs. ([source](https://github.com/go-resty/resty/blob/v3/load_balancer_test.go))
- [Network Traffic Inspectors](https://awesome-repositories.com/f/networking-communication/network-traffic-inspectors.md) — Captures and formats request and response details, including headers and bodies, for network debugging. ([source](https://github.com/go-resty/resty/blob/v3/debug.go))

### DevOps & Infrastructure

- [Request Retries](https://awesome-repositories.com/f/devops-infrastructure/api-service-management/api-resilience/request-retries.md) — Automatically repeats failed network requests based on specific status codes using exponential backoff. ([source](https://github.com/go-resty/resty/blob/v3/request.go))
- [Response Parsing Utilities](https://awesome-repositories.com/f/devops-infrastructure/response-parsing-utilities.md) — Extracts status codes, headers, and cookies from executed network requests as strings or byte slices. ([source](https://github.com/go-resty/resty/blob/v3/response.go))
- [Automatic Body Deserializers](https://awesome-repositories.com/f/devops-infrastructure/response-parsing-utilities/automatic-body-deserializers.md) — Automatically converts JSON response bodies into Go objects, lists, or streamed objects based on content type. ([source](https://github.com/go-resty/resty/blob/v3/stream_test.go))

### Software Engineering & Architecture

- [Request Lifecycle Management](https://awesome-repositories.com/f/software-engineering-architecture/request-lifecycle-management.md) — Associates Go contexts with requests to handle cancellation signals and timeouts across network calls. ([source](https://github.com/go-resty/resty/blob/v3/context_test.go))
- [Resilient Networking Patterns](https://awesome-repositories.com/f/software-engineering-architecture/resilient-networking-patterns.md) — Implements service stability patterns including request retries, circuit breakers and rate limiting.
- [Retry Strategies](https://awesome-repositories.com/f/software-engineering-architecture/retry-strategies.md) — Automatically repeats failed network calls using increasing delay intervals based on status codes or errors.
- [Request Hedging](https://awesome-repositories.com/f/software-engineering-architecture/request-hedging.md) — Sends multiple parallel requests with a configured delay, returning the first successful response to reduce tail latency. ([source](https://github.com/go-resty/resty/blob/v3/hedging.go))
- [Request Interception Middleware](https://awesome-repositories.com/f/software-engineering-architecture/request-interception-middleware.md) — Ships a middleware system to intercept request and response lifecycles for credential injection and logging.
- [Request Rate Limiting](https://awesome-repositories.com/f/software-engineering-architecture/traffic-management/request-rate-limiting.md) — Includes token-bucket rate limiting to control the frequency of outgoing requests and prevent API quota exhaustion. ([source](https://github.com/go-resty/resty/blob/v3/rate_limiter_test.go))

### Web Development

- [Request Interception Middleware](https://awesome-repositories.com/f/web-development/request-interception-middleware.md) — Executes pluggable functions to resolve addresses, inject credentials, and prepare request bodies before dispatch. ([source](https://github.com/go-resty/resty/blob/v3/middleware.go))
- [REST Clients](https://awesome-repositories.com/f/web-development/rest-clients.md) — Functions as a REST API client with automatic content-type detection and data serialization.
- [Multipart Upload Utilities](https://awesome-repositories.com/f/web-development/multipart-upload-utilities.md) — Provides utilities for sending files and form fields using the multipart/form-data content type. ([source](https://github.com/go-resty/resty/blob/v3/multipart.go))
- [Request and Response Transformers](https://awesome-repositories.com/f/web-development/request-body-deserializers/request-and-response-transformers.md) — Binds response bodies directly into specified result objects or error structures for automatic parsing. ([source](https://github.com/go-resty/resty/blob/v3/request.go))
- [Content-Type Based Deserializers](https://awesome-repositories.com/f/web-development/request-body-deserializers/request-and-response-transformers/content-type-based-deserializers.md) — Maps response bodies to Go structures by detecting the media type header and selecting the appropriate decoder. ([source](https://github.com/go-resty/resty/blob/v3/util_test.go))
- [Request Body Handling](https://awesome-repositories.com/f/web-development/request-body-handling.md) — Transforms data structures into wire formats based on the request content-type header. ([source](https://github.com/go-resty/resty/blob/v3/stream.go))
- [Server-Sent Events](https://awesome-repositories.com/f/web-development/server-sent-events.md) — Provides a client for consuming real-time data streams via the Server-Sent Events protocol.

### Data & Databases

- [Response Decoders](https://awesome-repositories.com/f/data-databases/data-processing-pipelines/data-processing/data-serialization-parsing/response-decoders.md) — Parses incoming response streams into data structures using content-type headers for various object formats. ([source](https://github.com/go-resty/resty/blob/v3/stream.go))

### System Administration & Monitoring

- [Request Correlation](https://awesome-repositories.com/f/system-administration-monitoring/request-correlation.md) — Assigns unique correlation IDs to requests to relate individual network calls across distributed logs. ([source](https://github.com/go-resty/resty/blob/v3/request.go))
- [Request Tracing](https://awesome-repositories.com/f/system-administration-monitoring/request-tracing.md) — Records detailed timing and connection metrics, including DNS lookup and TLS handshake duration. ([source](https://github.com/go-resty/resty/blob/v3/trace.go))
