WARNING: Invalid HTTP request received. Only when running GET request from inside of Excel
See original GitHub issueI am trying to write an Excel addin that uses node.js to make a GET request to a fastapi/uvicorn server on localhost. Below is the function I wrote:
function getData() {
//You can change this URL to any web request you want to work with.
const http = require('http');
const options = {
hostname: 'localhost',
port: 8000,
path: '/1/2/3/4',
method: 'GET'
};
const req = http.request(options, res => {
res.on('data', d => {
process.stdout.write(d)
})
})
req.on('error', error => {
console.error(error)
})
req.end()
}
If I run this in a terminal with node, it runs fine and shows a 200 response on the server. If I try running the function from within Excel as a UDF, it displays 0 in the cell and the server gives the following traceback:
WARNING: Invalid HTTP request received.
Traceback (most recent call last):
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 172, in handle_events
event = self.conn.next_event()
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_connection.py", line 443, in next_event
exc._reraise_as_remote_protocol_error()
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_util.py", line 76, in _reraise_as_remote_protocol_error
raise self
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_connection.py", line 425, in next_event
event = self._extract_next_receive_event()
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_connection.py", line 367, in _extract_next_receive_event
event = self._reader(self._receive_buffer)
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_readers.py", line 72, in maybe_read_from_IDLE_client
matches = validate(
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_util.py", line 88, in validate
raise LocalProtocolError(msg)
h11._util.RemoteProtocolError: illegal request line: bytearray(b'\x16\x03\x01\x02\x00\x01\x00\x01\xfc\x03\x03\xb2vs;\xdaP\xfb[\x17o\xbb\x9d:>\x12@\xe2\xd8\xae\xfa5H\x0e\xac\xb9"d\xe8\x89\xd4No \xb2\x98\xb5\xd9\xe5\x93?\xdeT\xbf\xa5Q\xf4\xac9\x19\x81?]\x05\x14\x1at\xf5\xca\xde\xbd\xea\xa2\xe7l\x008')
WARNING: Invalid HTTP request received.
Traceback (most recent call last):
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 172, in handle_events
event = self.conn.next_event()
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_connection.py", line 443, in next_event
exc._reraise_as_remote_protocol_error()
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_util.py", line 76, in _reraise_as_remote_protocol_error
raise self
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_connection.py", line 425, in next_event
event = self._extract_next_receive_event()
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_connection.py", line 367, in _extract_next_receive_event
event = self._reader(self._receive_buffer)
File "/Users/rgodbey/Desktop/spade/venv/lib/python3.8/site-packages/h11/_readers.py", line 68, in maybe_read_from_IDLE_client
raise LocalProtocolError("illegal request line")
h11._util.RemoteProtocolError: illegal request line
My thought is that somehow Excel is doing something to the GET request. Any help in debugging this is appreciated! I am unsure how to log the GET request so I can see what is happening.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
WARNING: Invalid HTTP request received ... - Microsoft Learn
I am trying to write an Excel addin that uses node.js to make a GET request to a fastapi/uvicorn server on localhost.
Read more >WARNING: Invalid HTTP request received. Only when running ...
I am trying to write an Excel addin that uses node.js to make a GET request to a fastapi/uvicorn server on localhost.
Read more >Invalid HTTP request received with Fast API - Stack Overflow
I have a React front end making requests to ...
Read more >A Complete Guide and List of HTTP Status Codes
A complete list of HTTP status codes with explaination of what they are, why they occur and what you can do to fix...
Read more >Content-Disposition - HTTP - MDN Web Docs
In a regular HTTP response, the Content-Disposition response header ... Request header, Response header (for a subpart of a multipart body).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, this was brought upon https://github.com/encode/uvicorn/pull/205
Everything worked once we had the client escape the space in the URL (
/teams?g=fc%20G
).