Skip to content

Commit

Permalink
Merge pull request #10 from Simversity/v3
Browse files Browse the repository at this point in the history
V3
  • Loading branch information
meson10 committed Jun 12, 2015
2 parents f6b22ec + a46847a commit 7be300f
Show file tree
Hide file tree
Showing 17 changed files with 548 additions and 224 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ before_install:
- cd $HOME/gopath/src/gopkg.in/simversity/gottp.v2

script:
- go test -v ./...
- go build -v ./...

notifications:
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Installation
Installation is as easy as:

```
go get gopkg.in/simversity/gottp.v2
go get gopkg.in/simversity/gottp.v3
```

Getting Started
Expand Down Expand Up @@ -60,7 +60,7 @@ A minimalist extended configuration looks like:

```
import (
"gopkg.in/simversity/gottp.v2/conf"
"gopkg.in/simversity/gottp.v3/conf"
)
type config struct {
Expand Down Expand Up @@ -93,7 +93,7 @@ A sample urls.go looks like:
package main
import (
"gopkg.in/simversity/gottp.v2"
"gopkg.in/simversity/gottp.v3"
)
func init(){
Expand All @@ -113,7 +113,7 @@ A sample handler looks like:
package handlers
import (
"gopkg.in/simversity/gottp.v2"
"gopkg.in/simversity/gottp.v3"
)
type HelloMessage struct {
Expand All @@ -135,7 +135,7 @@ package main
import (
"log"
"gopkg.in/simversity/gottp.v2"
"gopkg.in/simversity/gottp.v3"
)
func main() {
Expand Down Expand Up @@ -399,7 +399,7 @@ NOTE: At this moment, gottp only supports the option of one background worker.
Usage:

```go
import "gopkg.in/simversity/gottp.v2"
import "gopkg.in/simversity/gottp.v3"

func main() {
gottp.RunWorker(func(exitChan bool) {
Expand Down
17 changes: 17 additions & 0 deletions elapsed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package gottp

import (
"log"
"net/http"
"time"
)

func timeTrack(start time.Time, req *http.Request) {
elapsed := time.Since(start)
log.Printf("[%s] %s %s %s\n", req.Method, req.URL, req.RemoteAddr, elapsed)
}

func pipeTimeTrack(start time.Time, req *http.Request, pipeUrls string) {
elapsed := time.Since(start)
defer log.Printf("[%s] %s %s [%s] %s\n", req.Method, req.URL, req.RemoteAddr, pipeUrls, elapsed)
}
2 changes: 1 addition & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gottp
import (
"net/http"

utils "gopkg.in/simversity/gottp.v2/utils"
utils "gopkg.in/simversity/gottp.v3/utils"
)

type HttpError struct {
Expand Down
2 changes: 1 addition & 1 deletion exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"html/template"

utils "gopkg.in/simversity/gottp.v2/utils"
utils "gopkg.in/simversity/gottp.v3/utils"
)

const errorExtra = `
Expand Down
13 changes: 13 additions & 0 deletions global_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gottp

import (
"net/http"
"time"
)

func GlobalHandler(w http.ResponseWriter, req *http.Request) {
defer timeTrack(time.Now(), req)
request := Request{Writer: w, Request: req}
doRequest(&request, &boundUrls)
return
}
208 changes: 0 additions & 208 deletions httpserver.go

This file was deleted.

Loading

0 comments on commit 7be300f

Please sign in to comment.