chotiwat / go-request

A simple library for making http requests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-request

Build Status

This is a simple convenience library for making service requests and deserializing the results to objects either from JSON or from XML.

Usage

Here is an exmple of fetching an object:

myObject := MyObject{}
reqErr := request.NewRequest().AsGet().WithUrl("http://myservice.com/api/foo").JSON(&myObject)

Here is an example of fetching a raw response:

res, res_err := request.NewRequest().AsGet().WithUrl(host).WithTimeout(5000).FetchRawResponse()
defer res.Body.Close()
//... do things with the raw body ...

About

A simple library for making http requests.

License:MIT License


Languages

Language:Go 99.7%Language:Makefile 0.3%