Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ go get -u github.com/devfeel/dotweb

## 2. Getting Started
```go
func StartServer() error {
func main() {
//init DotApp
app := dotweb.New()
//set log path
Expand All @@ -35,7 +35,7 @@ func StartServer() error {
})
//begin server
err := app.StartServer(80)
return err
fmt.Println("dotweb.StartServer error => ", err)
}

```
Expand Down
2 changes: 2 additions & 0 deletions example/middleware/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ func main() {
//开启development模式
app.SetDevelopmentMode()

app.UseTimeoutHook(dotweb.DefaultTimeoutHookHandler, time.Second * 10)

exAccessFmtLog := NewAccessFmtLog("appex")
exAccessFmtLog.Exclude("/index")
exAccessFmtLog.Exclude("/v1/machines/queryIP/:IP")
Expand Down
2 changes: 1 addition & 1 deletion request.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (req *Request) Path() string {

// IsAJAX returns if it is a ajax request
func (req *Request) IsAJAX() bool {
return req.Header.Get(HeaderXRequestedWith) == "XMLHttpRequest"
return strings.Contains(req.Header.Get(HeaderXRequestedWith), "XMLHttpRequest")
}

// Url get request url
Expand Down
6 changes: 6 additions & 0 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,9 @@ func (w *gzipResponseWriter) Flush() {
func (w *gzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return w.ResponseWriter.(http.Hijacker).Hijack()
}


// Push support http2 Push
func (r *Response) Push(target string, opts *http.PushOptions) error {
return r.writer.(http.Pusher).Push(target, opts)
}
25 changes: 25 additions & 0 deletions version.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
## dotweb版本记录:

#### Version 1.5.9.5
* Fixed Bug: Request.IsAJAX check X-Requested-With Contains XMLHttpRequest
* New Feature: Response support http2 Push
* How To:
- how to query slow response in your app?
~~~go
func main() {
app := dotweb.Classic("/home/logs/wwwroot/")

// deal slow response, use default handler
// default Handler will write timeout-response in dotweb's log file
// also you can implement your own handlers, like write logs with http api
app.UseTimeoutHook(dotweb.DefaultTimeoutHookHandler, time.Second * 10)

app.HttpServer.GET("/index", func(ctx dotweb.Context) error{
return ctx.WriteString("welcome to my first web!")
})

//begin server
err := app.StartServer(80)
fmt.Println("dotweb.StartServer error => ", err)
}
~~~
* 2019-01-02 18:00

#### Version 1.5.9.4
* Fix UT in cache/runtime
* Remove invalid lock in cache/runtime
Expand Down