Skip to content

jad21/fetch

 
 

Repository files navigation

Build Status Godoc license Go Report Card

Fetch HTTP Client

Búsqueda simple realizada en Go para simplificar la vida del programador.

Install

Default

go get github.com/jad21/fetch

Import

import (
  "github.com/jad21/fetch"
)

Test

Para ejecutar la prueba del proyecto

go test -v --cover

Example:

Simple

response, err := fetch.Get("https://httpbin.org/get/", nil)

Custom Headers

header := http.Header{
    "Content-Type": []string{"application/json"},
    "User-Agent":   []string{"My-User-Agent"},
}
f := fetch.New(fetch.WithHeader(header))
rsp, err := f.Get("https://httpbin.org/headers", nil)

Simple JSON POST

login := map[string]interface{}{
	"username": "jad21",
	"password": "loremIpsum",
}
response, err := fetch.
		IsJSON().
		Post("https://httpbin.org/post/", fetch.NewReader(login))

Packages

No packages published

Languages

  • Go 100.0%