FAQ
Hello,

in node.js I used to allow following url:
http://localhost:3000/customers?filter[name]=Gopher

Unfortunately go's `net/url` does not parse this.

Is there some workaround?

Bo

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • James Bardin at Jun 30, 2014 at 5:01 pm
    What exactly doesn't parse?
    http://play.golang.org/p/erNLnSJ3LR


    On Monday, June 30, 2014 12:57:09 PM UTC-4, i...@bodokaiser.io wrote:

    Hello,

    in node.js I used to allow following url:
    http://localhost:3000/customers?filter[name]=Gopher

    Unfortunately go's `net/url` does not parse this.

    Is there some workaround?

    Bo
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • James Bardin at Jun 30, 2014 at 5:15 pm

    On Mon, Jun 30, 2014 at 1:02 PM, Bodo Kaiser wrote:

    I want to do something like: url.Get(„filter“)[„name“]

    That's just not how query parameters work; they are key/value pairs, which
    can accept multiple values.

    Apparently node.js will parse certain formats into a map, but it's not
    standard, and in Go you'll likely have to parse that yourself (or find a
    library that does so).


    Am 30.06.2014 um 19:01 schrieb James Bardin <j.bardin@gmail.com>:

    What exactly doesn't parse?
    http://play.golang.org/p/erNLnSJ3LR


    On Monday, June 30, 2014 12:57:09 PM UTC-4, i...@bodokaiser.io wrote:

    Hello,

    in node.js I used to allow following url: http://localhost:3000/
    customers?filter[name]=Gopher

    Unfortunately go's `net/url` does not parse this.

    Is there some workaround?

    Bo
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Stephen Day at Jun 30, 2014 at 5:04 pm
    Seems to parse as expected here: http://play.golang.org/p/oYE7mgKh_W

    Were you expecting it to parse differently?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Stephen Day at Jun 30, 2014 at 6:59 pm
    You could build a function that post-processes url.Values to get out the
    datastructure you require for your application:

    http://play.golang.org/p/voXxaiwlfl

    Note that this is a pretty shoddy implementation, but demonstrates the
    concept.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJun 30, '14 at 4:57p
activeJun 30, '14 at 6:59p
posts5
users3
websitegolang.org

3 users in discussion

James Bardin: 2 posts Stephen Day: 2 posts I: 1 post

People

Translate

site design / logo © 2021 Grokbase