Skip to content

Commit

Permalink
- Add isLocalRequest flag in context
Browse files Browse the repository at this point in the history
  • Loading branch information
legion-zver committed May 26, 2018
1 parent eba7e45 commit 8797498
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ import (
// Request Context struct.
type Context struct {
// Private props.
app IApplication // Application.
routeInfo IRouteInfo // Current route info.
routeParams map[string]string // Current route params.
handleIndex int // Current handler index.
app IApplication // Application.
routeInfo IRouteInfo // Current route info.
routeParams map[string]string // Current route params.
handleIndex int // Current handler index.
isLocalRequest bool

// Public props.
Meta map[string]interface{} // Metadata.
Expand Down Expand Up @@ -719,3 +720,7 @@ func (c *Context) ResetBodyReaderPosition() error {
_, err := topSeekReader(c.Request.Body, true)
return err
}

func (c *Context) IsLocalRequest() bool {
return c.isLocalRequest
}
1 change: 1 addition & 0 deletions just.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ func (app *application) LocalDo(req *http.Request) IResponse {
defer app.pool.Put(c)

c.Request, c.IsFrozenRequestBody = req, true
c.isLocalRequest = true

httpMethod, path := c.Request.Method, c.Request.URL.Path
if app.checkMethodForHaveBody(httpMethod) && c.Request.Body != nil {
Expand Down

0 comments on commit 8797498

Please sign in to comment.