gleam-lang / stdlib

🎁 Gleam's standard library
https://hexdocs.pm/gleam_stdlib/
Apache License 2.0
413 stars 152 forks source link

uri.origin should not have any path #623

Open CrowdHailer opened 1 month ago

CrowdHailer commented 1 month ago

https://github.com/gleam-lang/stdlib/blob/v0.38.0/test/gleam/uri_test.gleam#L409-L425

I think these tests are wrong in that the origin should be http://example.test (without trailing slash)`. The examples in the function documentation show it without a slash

markholmes commented 4 weeks ago

I think you're correct @CrowdHailer -- https://developer.mozilla.org/en-US/docs/Web/API/URL/origin

Screenshot 2024-06-08 at 10 19 17 PM

This is easy to reproduce too:

import gleam/io
import gleam/uri

pub fn main() {
  let url = "https://gleam.run/"
  let assert Ok(uri) = uri.parse(url)
  let assert Ok(origin) = uri.origin(uri)
  io.println(origin)
}

Results in:

https://gleam.run/

When it should be:

https://gleam.run
lpil commented 3 weeks ago

Thank you