Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion websock/websock.nim
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,15 @@ proc connect*(
if uri.port.len <= 0:
uri.port = if secure: "443" else: "80"

let pathQuery =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would $uri work here? It should reconstruct the whole uri (including logins etc)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. This string will eventually get passed to HttpClient.request and used in generateHeaders, which only uses the path and query parts of the Uri.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I misunderstood the question. It should work, it just would be equivalent to {path}?{query} with the current implementation of all the other stuff. But {path}?{query} is a smaller deviation IMO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rebase and add a test case.

if uri.query.len == 0:
uri.path
else:
uri.path & "?" & uri.query

return WebSocket.connect(
host = uri.hostname & ":" & uri.port,
path = uri.path,
path = pathQuery,
hostName = uri.hostname,
protocols = protocols,
factories = factories,
Expand Down