@@ -40,7 +40,7 @@ Lightbug currently has the following features:
4040- Bound Logger - [ @toasty/stump ] ( https://github.com/thatstoasty/stump )
4141- Terminal text styling - [ @toasty/mog ] ( https://github.com/thatstoasty/mog )
4242- CLI Library - [ @toasty/prism ] ( https://github.com/thatstoasty/prism )
43- - Date/Time - [ @mojoto/morrow ] ( https://github.com/mojoto/morrow.mojo )
43+ - Date/Time - [ @mojoto/morrow ] ( https://github.com/mojoto/morrow.mojo ) and [ @ toasty/small-time ] ( https://github.com/thatstoasty/small-time )
4444
4545<p align =" right " >(<a href =" #readme-top " >back to top</a >)</p >
4646
@@ -160,6 +160,7 @@ Create a file, e.g `client.mojo` with the following code. Run `magic run mojo cl
160160from lightbug_http.http import HTTPRequest
161161from lightbug_http.uri import URI
162162from lightbug_http.sys.client import MojoClient
163+ from lightbug_http.strings import to_string
163164
164165fn test_request(inout client: MojoClient) raises -> None:
165166 var uri = URI("http://httpbin.org/status/404")
@@ -168,19 +169,22 @@ fn test_request(inout client: MojoClient) raises -> None:
168169 except e:
169170 print("error parsing uri: " + e.__str__())
170171
172+
171173 var request = HTTPRequest(uri)
172174 var response = client.do(request)
173175
174- print("Status Code:", response.header.status_code())
176+ # print status code
177+ print("Response:", response.header.status_code())
175178
176- # print parsed headers (only selected headers are parsed for now)
177- print("Content-Type:", String (response.header.content_type()))
179+ # print parsed headers (only some are parsed for now)
180+ print("Content-Type:", to_string (response.header.content_type()))
178181 print("Content-Length", response.header.content_length())
179- print("Server:", String(response.header.server()))
182+ print("Server:", to_string(response.header.server()))
183+
180184 print("Is connection set to connection-close? ", response.header.connection_close())
181185
182186 # print body
183- print(String (response.get_body_bytes()))
187+ print(to_string (response.get_body_bytes()))
184188```
185189
186190Pure Mojo-based client is available by default. This client is also used internally for testing the server.
0 commit comments