summaryrefslogtreecommitdiffstats
path: root/tests/servers/invalid_json.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/servers/invalid_json.py')
-rw-r--r--tests/servers/invalid_json.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/servers/invalid_json.py b/tests/servers/invalid_json.py
new file mode 100644
index 0000000..5b40d7a
--- /dev/null
+++ b/tests/servers/invalid_json.py
@@ -0,0 +1,27 @@
+"""This server does nothing but print invalid JSON."""
+import asyncio
+import threading
+import sys
+from concurrent.futures import ThreadPoolExecutor
+
+from pygls.server import aio_readline
+
+
+def handler(data):
+ content = 'Content-Length: 5\r\n\r\n{"ll}'.encode("utf8")
+ sys.stdout.buffer.write(content)
+ sys.stdout.flush()
+
+
+async def main():
+ await aio_readline(
+ asyncio.get_running_loop(),
+ ThreadPoolExecutor(),
+ threading.Event(),
+ sys.stdin.buffer,
+ handler,
+ )
+
+
+if __name__ == "__main__":
+ asyncio.run(main())