Skip to content

Commit c57df47

Browse files
committed
Added fixed parameters addition on Reverse call
Added Go report card to readme Removed deprecation from Request.URL Added request for HTTP_URL Modified server adapter for go to provide HTTP_URL
1 parent fbcad28 commit c57df47

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Revel Framework
22

3-
[![Build Status](https://secure.travis-ci.org/revel/revel.svg?branch=master)](http://travis-ci.org/revel/revel) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
3+
[![Build Status](https://secure.travis-ci.org/revel/revel.svg?branch=master)](http://travis-ci.org/revel/revel)
4+
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5+
[![Go Report Card](https://goreportcard.com/badge/github.com/revel/revel)](https://goreportcard.com/report/github.com/revel/revel)
46

57
A high productivity, full-stack web framework for the [Go language](http://www.golang.org).
68

http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type Request struct {
3131
Method string
3232
RemoteAddr string
3333
Host string
34-
// DEPRECATED use request methods
34+
// URL request path from the server (built)
3535
URL *url.URL
3636
// DEPRECATED use GetForm()
3737
Form url.Values
@@ -80,7 +80,7 @@ func (req *Request) SetRequest(r ServerRequest) {
8080
req.ServerHeader.Server = h.(ServerHeader)
8181
}
8282

83-
req.URL, _ = url.Parse(req.GetRequestURI())
83+
req.URL,_ = req.GetValue(HTTP_URL).(*url.URL)
8484
req.ContentType = ResolveContentType(req)
8585
req.Format = ResolveFormat(req)
8686
req.AcceptLanguages = ResolveAcceptLanguage(req)

router.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,11 @@ func splitActionPath(actionPathData *ActionPathData, actionPath string, useCache
353353
}
354354
action = actionSplit[1]
355355
} else {
356-
WARN.Printf("Invalid action path %s ", actionPath)
356+
foundPaths := ""
357+
for path:=range actionPathCacheMap {
358+
foundPaths += path +","
359+
}
360+
WARN.Printf("Invalid action path %s found paths %s", actionPath, foundPaths)
357361
found = false
358362
}
359363

@@ -665,8 +669,10 @@ func (router *Router) Reverse(action string, argValues map[string]string) (ad *A
665669
if el == "" || (el[0] != ':' && el[0] != '*') {
666670
continue
667671
}
668-
669-
val, ok := argValues[el[1:]]
672+
val, ok := pathData.FixedParamsByName[el[1:]]
673+
if !ok {
674+
val, ok = argValues[el[1:]]
675+
}
670676
if !ok {
671677
val = "<nil>"
672678
ERROR.Print("revel/router: reverse route missing route arg ", el[1:])

server-engine.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const (
3333
HTTP_REQUEST_URI = iota + 1000
3434
HTTP_REMOTE_ADDR = iota + 1000
3535
HTTP_HOST = iota + 1000
36+
HTTP_URL = iota + 1000
3637
HTTP_SERVER_HEADER = iota + 1000
3738
HTTP_STREAM_WRITER = iota + 1000
3839
HTTP_WRITER = ENGINE_WRITER

server_adapter_go.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ func (r *GoRequest) Get(key int) (value interface{}, err error) {
211211
value = r.Original.URL.Path
212212
case HTTP_HOST:
213213
value = r.Original.Host
214+
case HTTP_URL:
215+
value = r.Original.URL
214216
case HTTP_BODY:
215217
value = r.Original.Body
216218
default:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy