Makes it so harness can bootstrap using the new GoRequest / response wrappers

This commit is contained in:
NotZippy
2017-04-04 17:17:23 -07:00
parent 0f47be728a
commit d2b1730439
2 changed files with 6 additions and 3 deletions

View File

@@ -286,7 +286,7 @@ func calcImportAliases(src *SourceInfo) map[string]string {
}
func addAlias(aliases map[string]string, importPath, pkgName string) {
alias, ok := aliases[importPath]
alias, ok := aliases[importPath]
if ok {
return
}
@@ -297,7 +297,7 @@ func addAlias(aliases map[string]string, importPath, pkgName string) {
func makePackageAlias(aliases map[string]string, pkgName string) string {
i := 0
alias := pkgName
for containsValue(aliases, alias) {
for containsValue(aliases, alias) || alias=="revel" {
alias = fmt.Sprintf("%s%d", pkgName, i)
i++
}

View File

@@ -47,7 +47,10 @@ type Harness struct {
proxy *httputil.ReverseProxy
}
func renderError(w http.ResponseWriter, r *http.Request, err error) {
func renderError(iw http.ResponseWriter, ir *http.Request, err error) {
r,w := &revel.GORequest{Goheader:&revel.GOHeader{}}, &revel.GOResponse{Goheader:&revel.GOHeader{}}
r.Set(ir)
w.Set(iw)
req, resp := revel.NewRequest(r), revel.NewResponse(w)
c := revel.NewController(req, resp)
c.RenderError(err).Apply(req, resp)