Giter Site home page Giter Site logo

Comments (13)

jeevatkm avatar jeevatkm commented on May 2, 2024 1

I have added the support. It's available on master. Give it a try and let me know.

from resty.

jvitoroc avatar jvitoroc commented on May 2, 2024 1

Has the function name changed overtime? It seems it is "SetQueryParamsFromValues" now.

from resty.

jeevatkm avatar jeevatkm commented on May 2, 2024

Just had a look. It seem these two lines L50 and L53 requires change from method Set to method Add.

Would like to you send PR or I can do it over weekend?

from resty.

guohuang avatar guohuang commented on May 2, 2024

I tried it, it didn't work, i looked further in net/url package, it is also a dictionary, so either way it will not work.


// Set sets the key to value. It replaces any existing
// values.
func (v Values) Set(key, value string) {
    v[key] = []string{value}
}

// Add adds the value to key. It appends to any existing
// values associated with key.
func (v Values) Add(key, value string) {
    v[key] = append(v[key], value)
}

from resty.

guohuang avatar guohuang commented on May 2, 2024

see this, https://golang.org/pkg/net/url/

func (Values) Add

func (v Values) Add(key, value string)
Add adds the value to key. It appends to any existing values associated with key.

from resty.

jeevatkm avatar jeevatkm commented on May 2, 2024

Update:
@guohuang I will add this support by today and let you know.

You're correct. Yes query param name is unique in the URI, as per URI RFC.

So as per RFC, you can get multi-value after changing those two lines I mentioned above.

for e.g.: ?status=pending&status=approved

from resty.

jeevatkm avatar jeevatkm commented on May 2, 2024

@guohuang I have updated the comment.

from resty.

guohuang avatar guohuang commented on May 2, 2024

yes, we can always use ?status=pending,approved as work around, but we want ?status=pending&status=approved, looking at https://github.com/go-resty/resty/blob/master/request.go#L91, your proposed solution doesn't work, as QueryParam is a dictionary.

from resty.

jeevatkm avatar jeevatkm commented on May 2, 2024

I will add this support, also I have updated the previous comment. Once done I will update this issue.

from resty.

guohuang avatar guohuang commented on May 2, 2024

yup, it works! thanks for the quick fix!

from resty.

jeevatkm avatar jeevatkm commented on May 2, 2024

Nice. I'm closing this one.

from resty.

jeevatkm avatar jeevatkm commented on May 2, 2024

BTW, I have added this new method SetMultiValueQueryParams.

from resty.

guohuang avatar guohuang commented on May 2, 2024

Nice! you are really quick and professional!

from resty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.