You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The stack trace points to an issue during the creation of headers in the HTTP.Response call. Specifically, the error arises in mkheaders, indicating that there's something unexpected in how the headers are passed.
A next test:
using HTTP
function simple_handler(req::HTTP.Request)
println("Simple handler")
# Log the request method, headers, and body
println("Request Method: ", HTTP.method(req))
println("Request Body: ", HTTP.payload(req))
# Simple response with no headers at all
response_body = "{\"message\": \"No Headers, Simple Response\"}"
return HTTP.Response(200, response_body)
end
had the following output:
POST
http://localhost:4091/get_networks
Status
200
OK
VersionHTTP/1.1
Transferred89 B (42 B size)
Referrer Policystrict-origin-when-cross-origin
DNS ResolutionSystem \n response: message "No Headers, Simple Response" \n output in terminal: Simple handler
Request Method: POST
Request Body: UInt8[0x7b, 0x22, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x22, 0x3a, 0x22, 0x4d, 0x69, 0x72, 0x6e, 0x61, 0x5f, 0x32, 0x22, 0x7d]
The fact that now we were getting a 200 OK status with the message "No Headers, Simple Response" seems to confirm that the issue was indeed related to the headers. By removing the headers, the error is no longer occurring, and the request is processed successfully. By introducing a header back in the error came also back.
The issue appears to be how HTTP.jl is interpreting or constructing headers, specifically related to its internal handling of key-value pairs for headers. The error invalid header key-value pair: { implies that HTTP.jl is encountering malformed data while building or sending the response headers.
Trying different versions didn't help. What can be done to overcome this error?
The text was updated successfully, but these errors were encountered:
The method signature for HTTP.Response with body and headers is Response(status, headers, body) not Response(status, body, headers).
Switching around response_body and headers in the first example works as expected for me.
Please specify the following versions when submitting a bug report:
When trying to find the reason for malfunctioning of Oxygen/HTTP CORS handling , we finally came to a minimal example using HTTP.jl only:
The output:
The stack trace points to an issue during the creation of headers in the HTTP.Response call. Specifically, the error arises in
mkheaders
, indicating that there's something unexpected in how the headers are passed.A next test:
had the following output:
The fact that now we were getting a 200 OK status with the message "No Headers, Simple Response" seems to confirm that the issue was indeed related to the headers. By removing the headers, the error is no longer occurring, and the request is processed successfully. By introducing a header back in the error came also back.
The issue appears to be how HTTP.jl is interpreting or constructing headers, specifically related to its internal handling of key-value pairs for headers. The error invalid header key-value pair: { implies that HTTP.jl is encountering malformed data while building or sending the response headers.
Trying different versions didn't help. What can be done to overcome this error?
The text was updated successfully, but these errors were encountered: