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

SetQueryParams supports map[string]interface{} maybe? #23

Closed
walktall opened this issue Jan 25, 2016 · 6 comments
Closed

SetQueryParams supports map[string]interface{} maybe? #23

walktall opened this issue Jan 25, 2016 · 6 comments
Assignees
Labels

Comments

@walktall
Copy link

Something like this...

resty.R().
    SetQueryParams(map[string]interface{}{
        "name": "xxx",
        "age": 10,
    })

also
SetQueryParam(param string, value interface{})

@jeevatkm
Copy link
Member

@zh-lab Actually URL query params are string always. That's why interface{} is not supported in those methods.

Do you have something else in your mind?

@jeevatkm jeevatkm self-assigned this Jan 25, 2016
@walktall
Copy link
Author

func (c *Client) SetQueryParams(params map[string]interface{}) *Client {
    for p, v := range params {
        c.QueryParam.Add(p, fmt.Sprint(v))
    }

    return c
}
func (c *Client) SetQueryParam(param string, value interface{}) *Client {
    c.QueryParam.Add(param, fmt.Sprint(value))
    return c
}

Then we could use int params without atoi?
Just my thoughts.

@jeevatkm
Copy link
Member

Implementing this way is okay, however changing existing method signature might break user code. I will get back to you about method signature or if you have suggestion please let me know.

@walktall
Copy link
Author

I see, thx!:smiley:

@jeevatkm
Copy link
Member

Currently I'm thinking about unique method signature. If you have any name suggestion let me know. I will bring this interface{} support.

@voronovmaksim
Copy link

6 years have passed, but the api is not implemented(

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

No branches or pull requests

3 participants