lightbug_http
lightbug_http copied to clipboard
Running the PythonClient Throws a Compilation Error
As reported by Logan logan100
on Discord:
Describe the bug
An error is thrown when trying to run the PythonClient
, sending a request to httpbin
:
➜ MojoTesting git:(main) ✗ mojo main.🔥
/Users/logan/Documents/MojoTesting/lightbug_http.📦:0:0: error: expected mlir::StringAttr, but got: #kgen.symbol.constant<@lightbug_http::@http::@HTTPRequest::@"__del__(lightbug_http::http::HTTPRequest)"> : !kgen.signature<!lit.signature<[1]("self": !lit.ref<@lightbug_http::@http::@HTTPRequest, mut *[0,0]> owned_in_mem, |) -> !kgen.none>>
/Users/logan/Documents/MojoTesting/lightbug_http.📦:0:0: error: expected mlir::StringAttr, but got: #kgen.symbol.constant<@lightbug_http::@uri::@URI::@"__del__(lightbug_http::uri::URI)"> : !kgen.signature<!lit.signature<[1]("self": !lit.ref<@lightbug_http::@uri::@URI, mut *[0,0]> owned_in_mem, |) -> !kgen.none>>
/Users/logan/Documents/MojoTesting/lightbug_http.📦:0:0: error: expected mlir::StringAttr, but got: #kgen.symbol.constant<@lightbug_http::@python::@client::@PythonClient::@"__del__(lightbug_http::python::client::PythonClient)"> : !kgen.signature<!lit.signature<[1]("self": !lit.ref<@lightbug_http::@python::@client::@PythonClient, mut *[0,0]> owned_in_mem, |) -> !kgen.none>>
/Users/logan/Documents/MojoTesting/lightbug_http.📦:0:0: error: expected mlir::StringAttr, but got: #kgen.symbol.constant<@lightbug_http::@header::@RequestHeader::@"__del__(lightbug_http::header::RequestHeader)"> : !kgen.signature<!lit.signature<[1]("self": !lit.ref<@lightbug_http::@header::@RequestHeader, mut *[0,0]> owned_in_mem, |) -> !kgen.none>>
To Reproduce Run the client like below
from lightbug_http.http import HTTPRequest
from lightbug_http.uri import URI
from lightbug_http.python.client import PythonClient
from lightbug_http.header import RequestHeader
fn test_request_simple_url(inout client: PythonClient) raises -> None:
"""
Test making a simple GET request without parameters.
Validate that we get a 200 OK response.
"""
var uri = URI("http://httpbin.org/status/200")
var request = HTTPRequest(uri)
var response = client.do(request)
print(response.header.status_code())
fn main() raises -> None:
var client = PythonClient()
test_request_simple_url(client)
Expected behavior The client should make a successful request to the endpoint specified and receive a response.