sparckles / Robyn

Robyn is a Super Fast Async Python Web Framework with a Rust runtime.
https://robyn.tech/
BSD 2-Clause "Simplified" License
4.45k stars 229 forks source link

Status Code 204 not returning properly #1009

Closed mardix closed 1 day ago

mardix commented 2 weeks ago

Bug Description

Given a status code 204, it will not return properly.

return Response(status_code=204, 
                     description=jsonify({...}), 
                     headers={"Content-Type": "application/json"})

As status code 204 is valid, how can we ensure any HTTP code get used used?

Steps to Reproduce

No response

Your operating system

MacOS

Your Python version (python --version)

3.11

Your Robyn version

latest

Additional Info

No response

VishnuSanal commented 2 weeks ago

hi @mardix, thanks for reaching out! but I have some questions.

it will not return properly

I didn't quite get this. from my initial testing, the following code seemed to work fine.

from robyn import Robyn, Response, jsonify

app = Robyn(__file__)

@app.get("/")
def h():
    return Response(
        status_code=204,
        description=jsonify({}),
        headers={"Content-Type": "application/json"}
    )

if __name__ == "__main__":
    app.start()

can you elaborate a bit on the issue and/or show us the code? thanks.

sansyrox commented 2 weeks ago

Hey @mardix 👋

Any update on it?

sansyrox commented 1 day ago

Alright, closing it. Will re-open it if it can be reproduced