gradew / ghttp

A simplified http client for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ghttp

This is basically a helper for HTTP clients in Go.

You can use common HTTP methods (GET, POST...), and you can pass a payload which will be sent as url-encoded or JSON.

package main

import (
        "fmt"
        "github.com/gradew/ghttp"
)

func main() {
        ghttp.SetInsecure(true)
        payload:=make(map[string]string)
        payload["username"]="mike"
        payload["secretkey"]="notmyrealpassword"

        response, body:=ghttp.Do("GET", "http://host", payload, true)
        fmt.Printf("Status: %d\n", response)
        fmt.Printf("Body: %s\n", body)
}

About

A simplified http client for Go


Languages

Language:Go 100.0%