Skip to content

A lightweight HTTP client package for Golang, designed to simplify and enhance HTTP communication in Go applications.

License

Notifications You must be signed in to change notification settings

calvin-puram/httpclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HttpClient

A lightweight HTTP client package for Golang

Installation

# Go Modules
require https://github.com/calvin-puram/httpclient/ghttp

Usage

// Import ghttp into your code.
import "github.com/calvin-puram/httpclient/ghttp"

// Configure the client
// First you need to configure and build the client as you need

reqHeaders := make(http.Header)
reqHeaders.Set("headers-key", "headers-value")

// setting global headers use:
SetHeaders(reqHeaders)
// setting user agent use:
SetUserAgent("user-agent")
// set max ideal connection per host use:
SetMaxIdleConns(5)
//specifies the amount of time to wait for a server's response headers after fully writing the request use:
SetResponseHeaderTimeout(5 * time.Second)
// default false: disable client request timeout use:
SetDisableTimeouts(false)


client := ghttp.NewBuilder().SetHeaders(reqHeaders).SetUserAgent("user-agent").
SetMaxIdleConns(5).SetResponseHeaderTimeout(5 * time.Second)SetDisableTimeouts(false).
Build() // build the client

Making HTTP calls

Take a look at all of the examples folder for more information on how to make http calls

About

A lightweight HTTP client package for Golang, designed to simplify and enhance HTTP communication in Go applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages