Skip to content

http reader with automatic content decompression

License

Notifications You must be signed in to change notification settings

oripio/respreader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP reader with automatic content decompression

Usage

Supported http content encodings: gzip, deflate, br (aka Brotli format)

package main

import (
	"github.com/oripio/respreader"
	"log"
	"net/http"
)

func main() {
	url := "https://google.com/"

	client := http.Client{}
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		log.Fatal(err)
	}

	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()

	bresp, err := respreader.Decode(resp)
	if err != nil {
		log.Fatal(err)
	}

	log.Print(string(bresp))
}

License

Brotli and these bindings are open-sourced under the MIT License - see the LICENSE file.

About

http reader with automatic content decompression

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages