New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

github.com/zakirkun/tomoe

Package Overview
Dependencies
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/zakirkun/tomoe

Source
Go Modules
Version
v0.0.0-20250411022933-7b7e87c4da78
Version published
Created
Source

TOMOE

⚡ Tomoe: A Flexible and Fast HTTP Client Library for Go

Tomoe is a lightweight and extensible HTTP client library for Go, designed to simplify making HTTP requests while providing flexibility, speed, and robust error handling. It supports generics for type-safe responses, retries, parallel execution, and dynamic body data formats such as JSON, form-data, and file uploads.

✨ Features

  • 🔒 Type-Safe Responses: Use generics to ensure type safety and reduce boilerplate.
  • 🔄 Retry Logic: Automatic retry with exponential backoff for resilient requests.
  • Parallel Execution: Perform concurrent HTTP requests efficiently using Goroutines.
  • 📦 Dynamic Body Support: Seamlessly handle JSON, form-data, and file uploads.
  • 🔧 Custom Headers and Query Parameters: Easily configure requests for any use case.
  • ⏱️ Timeouts: Control request execution time for better resource management.

📥 Installation

go get github.com/zakirkun/tomoe

🚀 Usage

  • Basic Setup
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/zakirkun/tomoe"
)

func main() {
    client := NewClient("https://jsonplaceholder.typicode.com", 30*time.Second, 3, 5*time.Second, nil)
	ctx := context.Background()

	// Single request with retries
	opts := RequestOptions{
		Method: "GET",
		Path:   "/todos/1",
	}

	response, err := client.Do(ctx, opts)  
    if err != nil {
		log.Fatalf("Request Error: %v", err.Error())
	}
    defer response.Body.Close()

    body, err := io.ReadAll(response.Body)
	if err != nil {
        log.Fatalf("Parse Body Error: %v", err.Error())
    }

    fmt.Printf("Success: %v", string(body))
}

👥 Contributions

Contributions are welcome! Please fork the repository and submit a pull request.

📝 License

Tomoe is licensed under the MIT License. See the LICENSE file for details.

✍️ Author

Created by Zakirkun. Inspired by a passion for elegant and efficient code.

FAQs

Package last updated on 11 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts