8000 GitHub - panwenbin/ghttpclient: Golang Simple Http Client
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

panwenbin/ghttpclient

Repository files navigation

GHttpClient

A method chaining HTTP Client for Golang with simple methods

Simple Methods

Get, Post, PostJson, PostForm, Put, PutJson, Patch, Delete, Options

Examples

package main

import (
	"fmt"
	"github.com/panwenbin/ghttpclient"
	"io/ioutil"
	"log"
)

func main() {
    response, err := ghttpclient.Get("http://www.panwenbin.com/", nil).Response()
    if err != nil {
        log.Fatal(err)
    }

    body, err := ghttpclient.ReadBodyClose(response)
    fmt.Printf("%s", body)
}
    body, err := ghttpclient.Get("http://www.panwenbin.com/", nil).ReadBodyClose()
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("%s", body)
headers := header.GHttpHeader{}
headers.UserAgent("ghttpclient")
response, err := ghttpclient.NewClient().
    Url("http://www.panwenbin.com/").
    Headers(headers).
    Get().Response()

API Reference: https://godoc.org/github.com/panwenbin/ghttpclient

About

Golang Simple Http Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0