Skip to content

Commit 0e79892

Browse files
committed
Fix client test headers
1 parent de0f946 commit 0e79892

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lightbug_http/header.mojo

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ struct Headers(Formattable, Stringable):
9898
# TODO (bgreni): Handle possible trailing whitespace
9999
var value = r.read_line()
100100
self._inner[to_string(key^).lower()] = to_string(value^)
101-
102101
return (to_string(first^), to_string(second^), to_string(third^))
103102

104103
fn format_to(self, inout writer: Formatter):

lightbug_http/sys/client.mojo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ struct MojoClient(Client):
8787
port = 443
8888
else:
8989
port = 80
90-
9190
var conn = create_connection(self.fd, host_str, port)
9291
var bytes_sent = conn.write(encode(req^))
9392
if bytes_sent == -1:
@@ -104,5 +103,5 @@ struct MojoClient(Client):
104103
except e:
105104
conn.close()
106105
raise e
107-
106+
108107
return HTTPResponse(Bytes())

tests/test_client.mojo

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from tests.utils import (
55
from lightbug_http.sys.client import MojoClient
66
from lightbug_http.http import HTTPRequest, encode
77
from lightbug_http.uri import URI
8-
from lightbug_http.header import Header
8+
from lightbug_http.header import Header, Headers
99
from lightbug_http.io.bytes import bytes
1010

1111

@@ -16,9 +16,11 @@ def test_client():
1616

1717
fn test_mojo_client_lightbug_external_req(client: MojoClient) raises:
1818
var req = HTTPRequest(
19-
uri=URI.parse("httpbin.org/status/200")[URI],
20-
headers=Header("Connection", "keep-alive"),
21-
protocol="GET",
19+
uri=URI.parse("http://httpbin.org/status/200")[URI],
20+
headers=Headers(
21+
Header("Connection", "keep-alive"),
22+
Header("Host", "httpbin.org")),
23+
method="GET",
2224
)
2325

2426
try:

0 commit comments

Comments
 (0)