mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 10:25:23 -04:00
15 lines
377 B
Python
15 lines
377 B
Python
from werkzeug.test import EnvironBuilder
|
|
from werkzeug.wrappers import Request
|
|
from dpkt.http import Request as DpktRequest
|
|
|
|
|
|
def parse_raw_request(raw_data: bytes):
|
|
req = DpktRequest(raw_data)
|
|
builder = EnvironBuilder(
|
|
method=req.method,
|
|
path=req.uri,
|
|
headers=req.headers,
|
|
data=req.body,
|
|
)
|
|
return Request(builder.get_environ())
|