Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCai1111 committed Nov 13, 2016
1 parent c9a42ab commit ea826a0
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# negotiator
[![Build Status](https://travis-ci.org/DavidCai1993/negotiator.svg?branch=master)](https://travis-ci.org/DavidCai1993/negotiator)
[![Coverage Status](https://coveralls.io/repos/github/DavidCai1993/negotiator/badge.svg)](https://coveralls.io/github/DavidCai1993/negotiator)

An HTTP content negotiator for Go

## Installation
Expand Down
45 changes: 45 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Package negotiator is an HTTP content negotiator for Go.
//
// Accept:
//
// // Assume that the Accept header is "text/html, application/*;q=0.9, image/jpeg;q=0.8"
// negotiator.Accept([]string{"text/html", "application/json", "image/jpeg"})
// // -> "text/html"
//
// negotiator.Accept([]string{"application/json", "image/jpeg", "text/plain"})
// // -> "application/json"
//
// negotiator.Accept([]string{"text/plain"})
// // -> ""
//
// Encoding:
//
// // Assume that the Accept-Encoding header is "gzip, compress;q=0.2, identity;q=0.5"
//
// negotiator.Encoding([]string{"identity", "gzip"})
// // -> "gzip"
//
// negotiator.Encoding([]string{"compress", "identity"})
// // -> "identity"
//
// Language:
//
// // Assume that the Accept-Language header is "en;q=0.8, es, pt"
//
// negotiator.Language([]string{"en", "es", "fr"})
// // -> "es"
//
// negotiator.Language([]string{"es", "pt"})
// // -> "es"
//
// Charset:
//
// // Assume that the Accept-Charset header is "utf-8, iso-8859-1;q=0.8, utf-7;q=0.2"
//
// negotiator.Charset([]string{"utf-8", "iso-8859-1", "iso-8859-5"})
// // -> "utf-8"
//
// negotiator.Charset([]string{"iso-8859-5"})
// // -> ""

package negotiator

0 comments on commit ea826a0

Please sign in to comment.