-
-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow global level Response headers #410
Conversation
✅ Deploy Preview for robyn canceled.
|
Thanks for the PR @ParthS007 . Great work like always! 😄
What do you mean by this? |
Both the methods Does this sounds clear? |
Ah, that makes sense. We can do that in the rust side of code. But for the python facing developer API, having separate functions allows the developers to make fewer errors. As in Robyn, we follow explicit functions for a lot of things. Would you like to work on this(integrating the rust side) btw? |
@sansyrox I can help with that, Can you please point me to the related code in source and I will start having a look. Is there anything else to add in this PR? |
@ParthS007 , I was talking about this function(https://github.com/sansyrox/robyn/pull/410/files#diff-48d27698cc708c7efe770fd897e4885efaa0a15cae30d54936068603ba03bbd9R241) and its equivalent. But I have been thinking about this. Do you think this optimization is necessary for a two-line function? Would a separation make more sense? |
I think we can merge this 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Great work! 😄 ✨
@sansyrox yeah okay. I think separation is good, more clear like this. 👍 |
@ParthS007 , a few tests are failing. Can you please rebase to the latest branch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ParthS007 ,
With the change in definition of spawn_process
, we will also have to change the args here(https://github.com/sansyrox/robyn/blob/09e24ef6ee1b64e89a277e17b72303bb86a4f9bc/robyn/processpool.py#L72) and here(https://github.com/sansyrox/robyn/blob/09e24ef6ee1b64e89a277e17b72303bb86a4f9bc/robyn/processpool.py#L88)
This is why the tests are failing
c412d42
to
bb6a11e
Compare
@@ -164,6 +164,7 @@ pub struct Response { | |||
|
|||
#[pymethods] | |||
impl Response { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sansyrox We need to make change here to check for response headers and create the Response accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ParthS007 , in the future yes. But would we need that for now too?
I suppose you are suggesting for things like json content?
@@ -194,6 +202,14 @@ async def request_headers(): | |||
} | |||
``` | |||
|
|||
```python | |||
@app.get("/response_headers") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have similar endpoint for response_header
as for request_header
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ParthS007 , we already have one here(https://github.com/sansyrox/robyn/pull/410/files#diff-aff15ced1fe37506f41f2e1d93a4d8312529259f7803f8634ffb5eac4de47823R196)
Is this the same one that you're suggesting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can merge and then work on this
Description
This PR fixes #335
add_response_header
&add_request_header
andremove_header
&remove_response_header
?