test_helpers.go 356 B

1234567891011121314151617
  1. // Copyright 2017 Manu Martinez-Almeida. All rights reserved.
  2. // Use of this source code is governed by a MIT style
  3. // license that can be found in the LICENSE file.
  4. package gin
  5. import (
  6. "net/http"
  7. )
  8. func CreateTestContext(w http.ResponseWriter) (c *Context, r *Engine) {
  9. r = New()
  10. c = r.allocateContext()
  11. c.reset()
  12. c.writermem.reset(w)
  13. return
  14. }