Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

float in get params #210

Open
kunkhmer opened this issue Apr 7, 2017 · 2 comments
Open

float in get params #210

kunkhmer opened this issue Apr 7, 2017 · 2 comments

Comments

@kunkhmer
Copy link

kunkhmer commented Apr 7, 2017

Im having a problem passing a float in .GET with params. Is there any solution for this problem? Any double will return "resource not found"

@kunkhmer kunkhmer changed the title double or float in get params float in get params Apr 7, 2017
@kunkhmer
Copy link
Author

I just ended up using .Post

@antitoine
Copy link

The documentation isn't very clear on how to get query parameters, but see #104

I succeed to get a float from query parameter:

func GetRecord(w rest.ResponseWriter, req *rest.Request) {
	if req.URL.Query().Get("startDate") != "" {
		if startDate, err := strconv.ParseFloat(req.URL.Query().Get("startDate"), 64); err == nil && startDate > 0 {
			// do somethings
		} else if err != nil {
			// do somethings
		}
	}
	// do somethings
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants