Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add redirect support, client certificate support, HTTP/2 support, and built-in middleware #35

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

CodeyCoo
Copy link
Contributor

Pull Request Description

This Pull Request introduces new features including redirect support, client certificate support, HTTP/2 support, and built-in middleware for headers, cookies, and caching.

Redirect Support:

  • Added automatic handling of HTTP redirects (e.g., 301, 302).
  • Configurable maximum redirect count and cross-origin redirect support.

Client Certificate Support:

  • Added support for loading and using client certificates (cert.pem and key.pem).
  • Provided SetCertificates method to configure client certificates.

HTTP/2 Support:

  • Enabled HTTP/2 by default.
  • Added fallback compatibility with HTTP/1.1.

Built-in Middleware:

  • Added Header, Cookie, and Cache middleware.
  • Header middleware: Supports custom request headers.
  • Cookie middleware: Automatically manages cookies.
  • Cache middleware: Implements request caching to reduce redundant requests.

Documentation Updates:

  • Added detailed documentation for the new features.
  • Provided example code and configuration guides.

Changes

New Files:

  • middleware/header.go: Header middleware implementation.
  • middleware/cookie.go: Cookie middleware implementation.
  • middleware/cache.go: Cache middleware implementation.
  • docs/redirect.md: Redirect feature documentation.
  • docs/client_certificates.md: Client certificate support documentation.
  • docs/http2.md: HTTP/2 support documentation.
  • docs/middleware.md: Middleware usage documentation.

Modified Files:

  • client.go: Added redirect, client certificate, and HTTP/2 support.
  • config.go: Added new configuration options.
  • README.md: Updated feature list and quickstart examples.

Testing

  • Redirect functionality tests.
  • Client certificate support tests.
  • HTTP/2 protocol tests.
  • Middleware functionality tests (Header, Cookie, Cache).

Impact

  • This change is backward-compatible.
  • New features are optional and do not affect existing behavior.

… support, and built-in middleware including header, cookie, cache middleware, and wrote corresponding functional documentation
@kaptinlin kaptinlin merged commit dff977b into kaptinlin:main Feb 13, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants