Uvicorn Denial
The uvicorn-denial
package implements the Websocket Denial Response on Uvicorn.
Installation
Usage
You can run the following code with python main.py
.
main.py
import uvicorn
import uvicorn_denial
async def app(scope, receive, send):
await send(
{
"type": "websocket.http.response.start",
"status": 200,
"headers": [("content-length", "4")]
}
)
await send({"type": "websocket.http.response.body", "body": b"haha"})
if __name__ == "__main__":
uvicorn.run(app, ws=uvicorn_denial.WSProtocol)
Then using curl, we can make calls to our server:
License
This project is licensed under the terms of the MIT license.