From c0b6922b52d667c609aec4a525201efe9e13d8f3 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Mon, 16 Mar 2015 14:38:40 -0700 Subject: [PATCH] New badges Signed-off-by: Vishal Rana --- .travis.yml | 8 ++++++++ README.md | 2 +- bolt.go | 41 +++++++++++++++++++++-------------------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4f2ee4d97..9a412e64a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1 +1,9 @@ language: go +go: + - tip +before_install: + - go get github.com/axw/gocov/gocov + - go get github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover +script: + - $HOME/gopath/bin/goveralls -service=travis-ci diff --git a/README.md b/README.md index 4724d5469..985c906a6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Bolt [![Build Status](https://travis-ci.org/labstack/bolt.svg?branch=master)](https://travis-ci.org/labstack/bolt) +# Bolt [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/labstack/bolt) [![Build Status](http://img.shields.io/travis/fatih/structs.svg?style=flat-square)](https://travis-ci.org/labstack/bolt) [![Coverage Status](http://img.shields.io/coveralls/labstack/bolt.svg?style=flat-square)](https://coveralls.io/r/labstack/bolt) Bolt is a fast HTTP router (zero memory allocation) + micro web framework in Go. ### Features diff --git a/bolt.go b/bolt.go index fb6a8dc83..31fa859ba 100644 --- a/bolt.go +++ b/bolt.go @@ -31,16 +31,17 @@ const ( HeaderContentType = "Content-Type" ) +// MethodMap is an index lookup for HTTP methods. var MethodMap = map[string]uint8{ - "CONNECT": 1, - "DELETE": 2, - "GET": 3, - "HEAD": 4, - "OPTIONS": 5, - "PATCH": 6, - "POST": 7, - "PUT": 8, - "TRACE": 9, + "CONNECT": 0, + "DELETE": 1, + "GET": 2, + "HEAD": 3, + "OPTIONS": 4, + "PATCH": 5, + "POST": 6, + "PUT": 7, + "TRACE": 8, } // New creates a bolt instance with options. @@ -111,57 +112,57 @@ func InternalServerErrorHandler(h HandlerFunc) Option { } } -// Use adds middleware(s) to the chain. +// Use adds middleware to the chain. func (b *Bolt) Use(h ...HandlerFunc) { b.handlers = append(b.handlers, h...) } -// Connect adds CONNECT route. +// Connect adds a CONNECT route. func (b *Bolt) Connect(path string, h ...HandlerFunc) { b.Handle("CONNECT", path, h) } -// Delete adds DELETE route. +// Delete adds a DELETE route. func (b *Bolt) Delete(path string, h ...HandlerFunc) { b.Handle("DELETE", path, h) } -// Get adds GET route. +// Get adds a GET route. func (b *Bolt) Get(path string, h ...HandlerFunc) { b.Handle("GET", path, h) } -// Head adds HEAD route. +// Head adds a HEAD route. func (b *Bolt) Head(path string, h ...HandlerFunc) { b.Handle("HEAD", path, h) } -// Options adds OPTIONS route. +// Options adds an OPTIONS route. func (b *Bolt) Options(path string, h ...HandlerFunc) { b.Handle("OPTIONS", path, h) } -// Patch adds PATCH route. +// Patch adds a PATCH route. func (b *Bolt) Patch(path string, h ...HandlerFunc) { b.Handle("PATCH", path, h) } -// Post adds POST route. +// Post adds a POST route. func (b *Bolt) Post(path string, h ...HandlerFunc) { b.Handle("POST", path, h) } -// Put adds PUT route. +// Put adds a PUT route. func (b *Bolt) Put(path string, h ...HandlerFunc) { b.Handle("PUT", path, h) } -// Trace adds TRACE route. +// Trace adds a TRACE route. func (b *Bolt) Trace(path string, h ...HandlerFunc) { b.Handle("TRACE", path, h) } -// Handle adds method, path and handler to the router. +// Handle adds method, path handler to the router. func (b *Bolt) Handle(method, path string, h []HandlerFunc) { h = append(b.handlers, h...) l := len(h)