stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

uri.origin should not have any path

Open CrowdHailer opened this issue 1 year ago • 2 comments
trafficstars

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

CrowdHailer avatar Jun 06 '24 11:06 CrowdHailer

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

markholmes avatar Jun 09 '24 05:06 markholmes

Thank you

lpil avatar Jun 10 '24 15:06 lpil