Skip to content

lattecake/request

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

使用方式

$ go get github.com/lattecake/request

application/x-www-form-urlencoded

import (
	"fmt"
	"github.com/lattecake/request"
	"net/url"
)

func main(){
	r := request.NewRequest()
	params := url.Values{}
	params.Set("a", "b")
	res, err, _ := r.Post("https://lattecake.com", params, nil, "")
	if err != nil {
		// error
		panic(err)
	}
	
	fmt.Println(string(res))
}

application/json

import (
	"fmt"
	"github.com/lattecake/request"
	"net/url"
)

func main(){
	r := request.NewRequest()
	params := url.Values{}
	params.Set("", `{"a":"b"}`)
	res, err, _ := r.Post("https://lattecake.com", params, map[string]string{
		"Context-Type": "application/json",
	}, "")
	if err != nil {
		// error
		panic(err)
	}

	fmt.Println(string(res))
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages