Commit 89fb60a9 by Carl Bergquist Committed by GitHub

Merge pull request #10020 from jomenxiao/master

fix render http[get] params error
parents 92821828 3f95180c
......@@ -10,7 +10,11 @@ import (
)
func RenderToPng(c *middleware.Context) {
queryReader := util.NewUrlQueryReader(c.Req.URL)
queryReader, err := util.NewUrlQueryReader(c.Req.URL)
if err != nil {
c.Handle(400, "Rander parameters error", err)
return
}
queryParams := fmt.Sprintf("?%s", c.Req.URL.RawQuery)
renderOpts := &renderer.RenderOpts{
......
......@@ -9,10 +9,15 @@ type UrlQueryReader struct {
values url.Values
}
func NewUrlQueryReader(url *url.URL) *UrlQueryReader {
return &UrlQueryReader{
values: url.Query(),
func NewUrlQueryReader(urlInfo *url.URL) (*UrlQueryReader, error) {
u, err := url.ParseQuery(urlInfo.String())
if err != nil {
return nil, err
}
return &UrlQueryReader{
values: u,
}, nil
}
func (r *UrlQueryReader) Get(name string, def string) string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment