Lightning-AI / Lightning-AI/LitServe
Support additional content types in post requests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.9k
- Forks
- 304
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 6
Description
🚀 Feature
Add support to additional content-type requests such as application/octet-stream
Motivation
It will make the Litserv more flexible. It will also allow streaming binary data.
Pitch
Basically add another option to the lines here https://github.com/Lightning-AI/LitServe/blob/c8cf6b224d68bbf2006b4b20198007ead3a58fd8/src/litserve/server.py#L351
that returns request.body()
if self.request_type == Request:
if request.headers["Content-Type"] == "application/x-www-form-urlencoded" or request.headers[
"Content-Type"
].startswith("multipart/form-data"):
payload = await request.form()
elif request.headers["Content-Type"] == "application/octet-stream":
payload = await request.body()
else:
payload = await request.json()
to support the following request
response = requests.post(API_URL, data = input_bytes, headers = {"Content-Type": "application/octet-stream"})
Alternatives
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/litserve/server.py at the request-handling code around the linked line, and trace how Content-Type selects the request parser. Add support for application/octet-stream so the request body is returned as bytes, then verify that a binary POST using that content type is accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100