compression

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2017 License: MIT Imports: 3 Imported by: 0

README

gentleman/compression Build Status GoDoc API Go Report Card

gentleman's plugin to disable and customize data compression in HTTP requests/responses.

Installation

go get -u gopkg.in/h2non/gentleman.v1/plugins/compression

API

See godoc reference.

Example

package main

import (
  "fmt"
  "gopkg.in/h2non/gentleman.v1"
  "gopkg.in/h2non/gentleman.v1/plugins/compression"
)

func main() {
  // Create a new client
  cli := gentleman.New()

  // Disable HTTP compression
  cli.Use(compression.Disable())

  // Perform the request
  res, err := cli.Request().URL("http://httpbin.org/gzip").Send()
  if err != nil {
    fmt.Printf("Request error: %s\n", err)
    return
  }
  if !res.Ok {
    fmt.Printf("Invalid server response: %d\n", res.StatusCode)
    return
  }

  fmt.Printf("Status: %d\n", res.StatusCode)
  fmt.Printf("Body: %s", res.String())
}

License

MIT - Tomas Aparicio

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disable

func Disable() p.Plugin

Disable disables the authorization basic header in the outgoing request

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL