gleam-lang / gleam-lang/fetch

Support Relative URLs

Open
#13 1 comment 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Gleam
Stars
61
Forks
16
Avg merge
5d 20h
Merged PRs (30d)
1

Description

the JS API supports URLs like `/path` but also `path` or `../path`. It's not possible to do with this library because Request forces you to have scheme and host.

You can set up a request with host set as the empty string but that doesn't work because the conversion of the request to string url results in `https:///path` which is an invalid URL. If the conversion resulted in `https:/path` it would have been better, as this is valid, but it's still not great forcing you to detect the scheme.

It's true that you can workaround this using FFI or an external library to get location and path, but it's a bit cumbersome, especially when relative paths like `../path` come into play, then you also have to write code to manipulate the path.

Maybe this issue brings to light an underlying problem with the Request type or its conversion to Uri and then to string, but if so, I wouldn't know how could these be fixed in a backward compatible way.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.