GithubHelp home page GithubHelp logo

Comments (7)

chshersh avatar chshersh commented on June 1, 2024 1

@mrkkrp Thanks for you effort in making Haskell ecosystem better!

from modern-uri.

mrkkrp avatar mrkkrp commented on June 1, 2024

Would it be enough, in your option, to state that rendering functions perform percent encoding automatically? I thought it's sort of obvious, because otherwise results of rendering would not be valid URI references.

from modern-uri.

chshersh avatar chshersh commented on June 1, 2024

@mrkkrp I'm interested not only in rendering but in parsing. For example, I have such URL:

https://my.youtrack.io/rest/issue?summary=Use `universum` package

And I wonder: whether I need to perform url encoding manually or url encoding is handled automatically by library? I'm working with http-types and http-client libraries and behavior of these libraries is very strange... Their functions perform some url encoding while parsing request URI but sometimes they cannot parse request. Thus I need to perform manual url encoding. And that's why I created this issue for more modern package.

from modern-uri.

mrkkrp avatar mrkkrp commented on June 1, 2024
https://my.youtrack.io/rest/issue?summary=Use `universum` package

That's not a valid URI, because query cannot contain spaces and ` character, they must be percent-encoded to appear in this part of a URI. The modern-uri package parses URIs according to RFC 3986, it would fail to parse the URI given above, and rightly so. I'm not sure what other packages do, and I'm not sure what could be changed about modern-uri, because its behavior makes sense (to me, at least).

from modern-uri.

mrkkrp avatar mrkkrp commented on June 1, 2024

Does my last comment answer your question? It's not clear to me whether I should close this or add something to the docs...

from modern-uri.

chshersh avatar chshersh commented on June 1, 2024

@mrkkrp Sorry, I'm not sure how things should work in URLs and in world because I didn't work much with in that area and I'm quite new there. I just was surprised by behavior of one library and couldn't find information about how things done in modern-uri. When I'm using http-client library I observe next behavior:

ghci> import Network.HTTP.Client
ghci> parseRequest "https://name.com/issue?title=My `title`&summary=123"
Request {
  host                 = "name.com"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/issue"
  queryString          = "?title=My%20%60title%60&summary=123"
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}

Here I can see that query string is automatically urlencoded. Well, this doesn't always work for me but that's another story. The thing is that I don't need to perform URL encoding manually. So I would like to see behavior of modern-uri in case I pass non-urlencoded string to it (like, it fails with exception or returns Nothing) and I would like to see how already creatde data types with encoded URL will be rendered.

from modern-uri.

mrkkrp avatar mrkkrp commented on June 1, 2024

I have pushed some clarifications to the docs.

from modern-uri.

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.