gokhttp

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2023 License: MIT Imports: 3 Imported by: 3

README

Golang HTTP Client

Go Report Card License

Introduction

gOkHttp is HTTP Client written in Golang inspired by Java's (now Kotlin's) OkHTTP and also slightly inspired by Python's Requests.

This library has been written with handling cookies (in-memory, on-disk, encrypted on-disk), headers, parameters, post fields, post multipart bodies, post files and SSL pinning in mind.

  • Inspired by okhttp
    • SSL Pinning implementation and ease of using it
  • Inspired by requests
    • Response processing (eg: responses.ResponseText(httpResp) to return response body as a string)
    • Making requests with headers and parameters as maps (there where in Python it's dicts)
Warning

This library is a lot more stable than it was back when I first wrote it, though it's far from perfect so do not use it for mission critical stuff

Installation

The package can be installed using "go get".

go get -u github.com/BRUHItsABunny/gOkHttp

Usage

There is a file filled with examples here, and you can find the Go docs here

NOTE for HLS streams

If the .ts file is broken, run it through FFmpeg in order to fix it real quick: ffmpeg -i file.ts -c copy file_fixed.ts

Contributions

Feel free to fork this repository and open up pull requests.

Todo

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient added in v0.0.7

func NewHTTPClient(options ...gokhttp_client.Option) (*http.Client, error)
Example

This function makes a basic `*http.Client` object

hClient, err := NewHTTPClient()
if err != nil {
	panic(err)
}
// Just to prevent unused error in IDE
fmt.Println(hClient)
Output:

func TestHTTPClient added in v0.2.4

func TestHTTPClient(options ...gokhttp_client.Option) (*http.Client, error)

TestHTTPClient is a function i end up using a lot in test files to control how my http.Client is initialized depending on the ENV variables USE_PROXY and PROXY_URL

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL