<commit_before># GWC (Go Web Client)
[![Go Report Card](https://goreportcard.com/badge/github.com/delicb/gwc)](https://goreportcard.com/report/github.com/delicb/gwc)
[![Build Status](https://travis-ci.org/delicb/gwc.svg?branch=master)](https://travis-ci.org/delicb/gwc)
[![codecov](https://codecov.io/gh/delicb/gwc/branch/master/graph/badge.svg)](https://codecov.io/gh/delicb/gwc)
![status](https://img.shields.io/badge/status-beta-red.svg)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/delicb/gwc)



GWC is GoLang HTTP client based on [Cliware](https://github.com/delicb/cliware)
client middleware management library and its [middlewares](https://github.com/delicb/cliware-middlewares).

Basic idea is to use same middleware mechanism on client side as many projects
use it for server development. 

Because it is based on middlewares client is very pluggable. However, even out 
of box it should support most common use cases.

# Install
Run `go get github.com/delicb/gwc` in terminal.

# Example
There is testable example in this repository. It basically does following:
```go
package gwc

import (
	"fmt"
	"net/http"

    "go.delic.rs/gwc"
	"go.delic.rs/cliware-middlewares/headers"
	"go.delic.rs/cliware-middlewares/errors"
)

type HTTPBinResponse struct {
	Headers struct {
		UserAgent string `json:"User-Agent"`
	} `json:"headers"`
}

func main() {
	respBody := new(HTTPBinResponse)

	client := gwc.New(
		http.DefaultClient,
		// Add user agent header, it will be applied to all requests
		headers.Add("User-Agent", "example-client"),
		errors.Errors(),
	)
	// send request<commit_msg>Fix paths in examples<commit_after># GWC (Go Web Client)
[![Go Report Card](https://goreportcard.com/badge/github.com/delicb/gwc)](https://goreportcard.com/report/github.com/delicb/gwc)
[![Build Status](https://travis-ci.org/delicb/gwc.svg?branch=master)](https://travis-ci.org/delicb/gwc)
[![codecov](https://codecov.io/gh/delicb/gwc/branch/master/graph/badge.svg)](https://codecov.io/gh/delicb/gwc)
![status](https://img.shields.io/badge/status-beta-red.svg)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/delicb/gwc)



GWC is GoLang HTTP client based on [Cliware](https://github.com/delicb/cliware)
client middleware management library and its [middlewares](https://github.com/delicb/cliware-middlewares).

Basic idea is to use same middleware mechanism on client side as many projects
use it for server development. 

Because it is based on middlewares client is very pluggable. However, even out 
of box it should support most common use cases.

# Install
Run `go get github.com/delicb/gwc` in terminal.

# Example
There is testable example in this repository. It basically does following:
```go
package gwc

import (
	"fmt"
	"net/http"

    "github.com/delicb/gwc"
	"github.com/delicb/cliware-middlewares/headers"
	"github.com/delicb/cliware-middlewares/errors"
)

type HTTPBinResponse struct {
	Headers struct {
		UserAgent string `json:"User-Agent"`
	} `json:"headers"`
}

func main() {
	respBody := new(HTTPBinResponse)

	client := gwc.New(
		http.DefaultClient,
		// Add user agent header, it will be applied to all requests
		headers.Add("User-Agent", "example-client"),
		errors.Errors(),
	)
	// send request
{'fraction_non_alphanumeric': 0.14682779456193354, 'fraction_numerical': 0.0, 'mean_word_length': 4.555369127516778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3415497', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1160, 'n_words': 260}