Skip to content

towithyou/go-requests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-requests

Installation

go get github.com/towithyou/go-requests

Quick Start

// reference requests_test.go
import (
	github.com/towithyou/go-requests
)

type RespData struct {
	Args    map[string]string `json:"args"`
	Data    string            `json:"data"`
	Headers struct {
		Accept                  string `json:"Accept"`
		AcceptEncoding          string `json:"Accept-Encoding"`
		AcceptLanguage          string `json:"Accept-Language"`
		Host                    string `json:"Host"`
		UpgradeInsecureRequests string `json:"Upgrade-Insecure-Requests"`
		UserAgent               string `json:"User-Agent"`
		XAmznTraceId            string `json:"X-Amzn-Trace-Id"`
		JWT                     string `json:"JWT"`
	} `json:"headers"`
	Origin string            `json:"origin"`
	Json   map[string]string `json:"json"`
	Url    string            `json:"url"`
}

func main() {
	var resp RespData
	_, err := requests.GetAndParse("http://httpbin.org/get", &resp)
	if err != nil {
		return
	}
	fmt.Printf("%+v", resp)
}

About

golang simple http request

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages